View Code of Problem 81

#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: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.


Back to problem 81