#include <stdio.h> int main() { int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int y,m,d,s=0; scanf("%d%d%d",y,m,d); for(i=0;i<m;++i) s+=a[i]; s+=d; if(y%4==0&&y%100!=0||y%400==0) if(m>2) s++; printf("%d",s); } /* Main.c: In function 'main': Main.c:6:3: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=] scanf("%d%d%d",y,m,d); ^ Main.c:6:3: warning: format '%d' expects argument of type 'int *', but argument 3 has type 'int' [-Wformat=] Main.c:6:3: warning: format '%d' expects argument of type 'int *', but argument 4 has type 'int' [-Wformat=] Main.c:7:7: error: 'i' undeclared (first use in this function) for(i=0;i<m;++i) ^ Main.c:7:7: note: each undeclared identifier is reported only once for each function it appears in Main.c:10:12: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(y%4==0&&y%100!=0||y%400==0) ^ Main.c:4:7: warning: variable 'a' set but not used [-Wunused-but-set-variable] int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; ^ */ |
Double click to view unformatted code.