第51页第十题
来源:互联网 发布:win10纯净版64位 知乎 编辑:程序博客网 时间:2024/06/10 02:58
#include<stdio.h>
int main()
{
int year,month;
int i=1;
do
{
printf("请输入年号和月份:\n");
scanf("%d%d",&year,&month);
if(year%400==0)
{
switch(month)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
printf("这年该月的天数为31天\n");
break;
case 2:
printf("这年该月的天数为29天\n");
break;
case 4:case 6:case 9:case 11:
printf("这年该月的天数为30天\n");
break;
}
}
else if(year%4==0)
{
switch(month)
{case 1:case 3:case 5:case 7:case 8:case 10:case 12:
printf("这年该月的天数为31天\n");
break;
case 2:
printf("这年该月的天数为29天\n");
break;
case 4:case 6:case 9:case 11:
printf("这年该月的天数为30天\n");
break;
}
}
else
{
switch(month)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
printf("这年该月的天数为31天\n");
break;
case 2:
printf("这年该月的天数为28天\n");
break;
case 4:case 6:case 9:case 11:
printf("这年该月的天数为30天\n");
break;
}
i++;
}
}while(i<=5);
return 0;
}
int main()
{
int year,month;
int i=1;
do
{
printf("请输入年号和月份:\n");
scanf("%d%d",&year,&month);
if(year%400==0)
{
switch(month)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
printf("这年该月的天数为31天\n");
break;
case 2:
printf("这年该月的天数为29天\n");
break;
case 4:case 6:case 9:case 11:
printf("这年该月的天数为30天\n");
break;
}
}
else if(year%4==0)
{
switch(month)
{case 1:case 3:case 5:case 7:case 8:case 10:case 12:
printf("这年该月的天数为31天\n");
break;
case 2:
printf("这年该月的天数为29天\n");
break;
case 4:case 6:case 9:case 11:
printf("这年该月的天数为30天\n");
break;
}
}
else
{
switch(month)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
printf("这年该月的天数为31天\n");
break;
case 2:
printf("这年该月的天数为28天\n");
break;
case 4:case 6:case 9:case 11:
printf("这年该月的天数为30天\n");
break;
}
i++;
}
}while(i<=5);
return 0;
}
0 0
- 第51页第十题
- 第十周第一天
- 第十周第五天
- 第十一周第一天
- 第十一周第一天
- 第十周第一天
- 第十周第三天
- 第十一周第一天
- 第十四周第一天
- 第十四周第五天
- C++primer plus第十章第5题
- 王朝第十一周 第几天
- 第十题
- 第十题
- 第十题
- 第十题
- 第十题
- 第十题
- hdu 1690 Bus System 最短路 Floyd算法。。INF一定要很大很大。。。数据类型用long long。
- UITableViewCell点击时背景颜色
- 蓝桥杯---公式解析
- 【状压】 URAL 1500 Pass Licenses
- 百度面试题找到满足条件的数组
- 第51页第十题
- 2013年第五届蓝桥杯决赛C组题目 第一题 标题:好好学习
- HTML5开发准备
- 第四周项目四:指向学生类的指针
- java 反射
- Android 通过广播启动Activity
- 网卡流量监控工具vnstat的使用
- c++primer第十二章类12.1
- JavaScript DOM学习(4) 操作文本结点