Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int square(int a) {
  4. return a*a;
  5. }
  6.  
  7.  
  8. int main() {
  9. int N,i,a,j,k,b,count;
  10. scanf("%d",&N);
  11. for(i = 0; i < N; i++) {
  12. scanf("%d",&a);
  13. count = 0;
  14. for(j = 0; j <= a; j++) {
  15. for(k = 0; k <= j; k++) {
  16. b = square(j) + square(k);
  17. if(b == a) {
  18. count++;
  19. printf("\n%d + %d = %d\n",square(j),square(k),a);
  20. }
  21. }
  22. }
  23. printf("%d\n",count);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement