Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int square(int a) {
- return a*a;
- }
- int main() {
- int N,i,a,j,k,b,count;
- scanf("%d",&N);
- for(i = 0; i < N; i++) {
- scanf("%d",&a);
- count = 0;
- for(j = 0; j <= a; j++) {
- for(k = 0; k <= j; k++) {
- b = square(j) + square(k);
- if(b == a) {
- count++;
- printf("\n%d + %d = %d\n",square(j),square(k),a);
- }
- }
- }
- printf("%d\n",count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement