Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  11111
Language: C/C++
Code:
#include <stdio.h>
#include <math.h>
int main()
{
     int y,m,d,a;
     while(scanf("%d %d %d",y,m,d)!=EOF)
     {
          if(m==2) a=31+d;
          if(m==3) a=59+d;
          if(m==4) a=90+d;
          if(m==5) a=120+d;
          if(m==6) a=151+d;
          if(m==7) a=181+d;
          if(m==8) a=212+d;
          if(m==9) a=243+d;
          if(m==10) a=273+d;
          if(m==11) a=304+d;
          if(m==12) a=334+d;
          if(m==1)
          {
               printf("%d\n",d);
          }
          else
          {
              if((y%4==0&&y%100!=0)||(y%400==0))
              {
                   printf("%d\n",a+1);
              }
              else
              {
                   printf("%d\n",a);
              }
          }
     }
     return 0;
}
Comments: