作業



#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b;
printf("輸入年份和月份:");
scanf("%d%d",&a,&b);
if((a%4==0||a%100!=0)&&(a%400==0))
{
 if(b==(1||3||5||7||8||10||12))
   printf("這一年該月的天數爲31天\n");
  else if(b==2)
   printf("這一年該月的天數爲29天\n");
   else
   printf("這一年該月的天數爲30天\n");
}
else
{
if(b==(1||3||5||7||8||10||12))
printf("這一年該月的天數爲31天\n");
else if(b==2)
printf("這一年該月的天數爲28天\n");
  else
   printf("這一年該月的天數爲30天\n");
}

return 0;

}

發佈了33 篇原創文章 · 獲贊 3 · 訪問量 6819
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章