#include int main() { int a,b,i; int tmp=1; while(scanf("%d%d",&a,&b)!=EOF) { if(a/b==1) printf("%d\n",a/b); else { for(i=1;i<=a;i++) if(a%i==0&&b%i==0) tmp=i; printf("%d/%d\n",a/tmp,b/tmp); } } return 1; } /* Main.c:1:9: error: #include expects "FILENAME" or <FILENAME> #include ^ Main.c: In function 'main': Main.c:6:14: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] while(scanf("%d%d",&a,&b)!=EOF) ^~~~~ Main.c:6:14: warning: incompatible implicit declaration of built-in function 'scanf' Main.c:6:14: note: include '<stdio.h>' or provide a declaration of 'scanf' Main.c:1:1: +#include <stdio.h> #include Main.c:6:14: while(scanf("%d%d",&a,&b)!=EOF) ^~~~~ Main.c:6:35: error: 'EOF' undeclared (first use in this function) while(scanf("%d%d",&a,&b)!=EOF) ^~~ Main.c:6:35: note: 'EOF' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'? Main.c:6:35: note: each undeclared identifier is reported only once for each function it appears in Main.c:9:15: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] printf("%d\n",a/b); ^~~~~~ Main.c:9:15: warning: incompatible implicit declaration of built-in function 'printf' Main.c:9:15: note: include '<stdio.h>' or provide a declaration of 'printf' Main.c:15:15: warning: incompatible implicit declaration of built-in function 'printf' printf("%d/%d\n",a/tmp,b/tmp); ^~~~~~ Main.c:15:15: note: include '<stdio.h>' or provide a declaration of 'printf' */ |
Double click to view unformatted code.