编写程序,输入某年某月,求该月有多少天。
#include#include#include#includeint main(){ int year,month; printf("Input year,month:"); scanf("M%d",&year,&month); if ((year%4==0&&year0!=0)||(year@0==0)) { switch(month) { case 1: case 3: case 5: case...全部
#include#include#include#includeint main(){ int year,month; printf("Input year,month:"); scanf("M%d",&year,&month); if ((year%4==0&&year0!=0)||(year@0==0)) { switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: printf("31 days"); break; case 4: case 6: case 9: case 11: printf("30 days"); break; case 2: printf("29 days"); break; default: printf("Input error!"); } } else { switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: printf("31 days"); break; case 4: case 6: case 9: case 11: printf("30 days"); break; case 2: printf("28 days"); break; default: printf("Input error!"); } } return 0;}。
收起