我的仰视30
2015-04-19 04:37
#include <stdio.h>
int main()
{
int year = 2008;
int month = 8;
int day = 8;
int sum=0;
switch(month)
{
case 1:sum=sum+day;break;
case 2:sum=sum+day+31;break;
case 3:sum=sum+day+31+28;break;
case 4:sum=sum+day+31+28+31;break;
case 5:sum=sum+day+31+28+31+30;break;
case 6:sum=sum+day+31+28+31+30+31;break;
case 7:sum=sum+day+31+28+31+30+31+30;break;
case 8:sum=sum+day+31+28+31+30+31+30+31;break;
case 9:sum=sum+day+31+28+31+30+31+30+31+31;break;
case 10:sum=sum+day+31+28+31+30+31+30+31+31+30;break;
case 11:sum=sum+day+31+28+31+30+31+30+31+31+30+31;break;
case 12:sum=sum+day+31+28+31+30+31+30+31+31+30+31+30;break;
}
if((year%400==0)||(year%4==0&&year%100!=0)){printf("%d年%d月%d日是该年的第%d天",year,month,day,sum+1);}
else{printf("%d年%d月%d日是该年的第%d天",year,month,day,sum);}
return 0;
}
又见楼主
C语言入门
926207 学习 · 20797 问题
相似问题
回答 3
回答 1