scanf ("% d % d % d "; &year , &mon , &day ),判断这是这一年的第几天
#include<stdio.h>
int main(int argc, char const *argv[])
{
int year,mon,day,sum=0;
scanf("%d %d %d",&year,&mon,&day);
switch(mon)
{
case 1:sum+=day;break;
case 2:sum=day+31;break;
case 3:sum=day+31+28;break;
case 4:sum=day+31+28+31;break;
case 5:sum=day+31+28+31+30;break;
case 6:sum=day+31+28+31+30+31;break;
case 7:sum=day+31+28+31+30+31+30;break;
case 8:sum=day+31+28+31+30+31+30+31;break;
case 9:sum=day+31+28+31+30+31+30+31+31;break;
case 10:sum=day+31+28+31+30+31+30+31+31+30;break;
case 11:sum=day+31+28+31+30+31+30+31+31+30+31;break;
case 12:sum=day+31+28+31+30+31+30+31+31+30+31+30;break;
default :printf("输入错误\n");
return -1;
}
if ((year%4 == 0 && year%100 != 0 || year%400 == 0)&&mon > 2)
sum++;
printf("sum= %d\n",sum);
return 0;
}