#include<stdio.h> #include<math.h> int main(){ long int n,sum,k=0; while(scanf("%d",&n)!=EOF) { sum=0; if(n<=3) { sum=5; k++; } else { n-=3; if(1.5*n>int(1.5*n)) sum=5+int(1.5*n)+1; else sum=5+int(1.5*n); k++; } printf("Case #%d: %d\n",k,sum); } return 0; } /* Main.c: In function 'main': Main.c:6:2: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long int *' [-Wformat=] while(scanf("%d",&n)!=EOF) ^ Main.c:17:13: error: expected expression before 'int' if(1.5*n>int(1.5*n)) ^ Main.c:18:13: error: expected expression before 'int' sum=5+int(1.5*n)+1; ^ Main.c:20:11: error: expected expression before 'int' sum=5+int(1.5*n); ^ Main.c:23:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=] printf("Case #%d: %d\n",k,sum); ^ Main.c:23:3: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=] */ |
Double click to view unformatted code.