收藏 分享(赏)

读入一个年份和月份-打印出该月有多少天(考虑闰年)-用switch语句编程.doc

上传人:weiwoduzun 文档编号:5702667 上传时间:2019-03-13 格式:DOC 页数:1 大小:71.20KB
下载 相关 举报
读入一个年份和月份-打印出该月有多少天(考虑闰年)-用switch语句编程.doc_第1页
第1页 / 共1页
亲,该文档总共1页,全部预览完了,如果喜欢就下载吧!
资源描述

读入一个年份和月份,打印出该月有多少天(考虑闰年) ,用 switch 语句编程。#include main()int year, month;printf(“Input year,month: “);scanf(“%d, %d“, /*输入相应的年和月*/switch (month)case 1:case 3:case 5:case 7:case 8:case 10:case 12:printf(“31 daysn“);break;case 2:if(year % 4= 0 /*闰年的 2 月有 29 天 */elseprintf(“28 daysn“); /*平年的 2 月有 28 天 */break;case 4:case 6:case 9:case 11:printf(“30 daysn“);break;default:printf(“Input error!n“);

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报