为了账号安全,请及时绑定邮箱和手机立即绑定

#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+

#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;


正在回答

1 回答

又见楼主

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

#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+

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信