#include<stdio.h> #include<string.h> #include<math.h> #define N 1000 int main() { int a,b,i,j=0,arr[N]; double c; scanf("%d,%d", &a, &b); for(i = a; i <= b; i ++) { arr[j++] = i; } for(i = 0; i <= b-a; i ++) { for(j = 0; j <= b-a; j ++) { c = sqrt(arr[i]*arr[i] + arr[j]*arr[j]); if(int(c) == c) { if(c >= a && c <= b && arr[i] < arr[j]) { printf("%d^2 + %d^2 = %d^2\n",arr[i],arr[j],c); } } } } return 0; } /* Main.c: In function 'main': Main.c:20:16: error: expected expression before 'int' if(int(c) == c) ^~~ Main.c:24:40: warning: format '%d' expects argument of type 'int', but argument 4 has type 'double' [-Wformat=] printf("%d^2 + %d^2 = %d^2\n",arr[i],arr[j],c); ~^ ~ %f */ |
Double click to view unformatted code.