c-switch结构、年月日关系、判断闰年

根据用户输入的年份和月份,程序判断是否为闰年,并输出该月的天数。示例包括闰年2月的29天以及非法输入的处理。
摘要由CSDN通过智能技术生成

从键盘输入某年某月(包括闰年),编程输出该年的该月拥有的天数。

输入格式要求:"%d,%d" 提示信息:“Input year,month:” "The number of days is %d\n"
输出格式要求:"%d"
程序运行示例1如下:
Input year,month:1984,2
The number of days is 29
程序运行示例2如下:
Input year,month:2000,2
The number of days is 29
程序运行示例3如下:
Input year,month:1985,2
The number of days is 28
程序运行示例4如下:
Input year,month:1983,13
Input year,month:1983,-1
Input year,month:1983,1
The number of days is 31

#include<stdio.h>
int JudgeYear(int year);
int main()
{
   
    int year, month, days, result;
    do	// 输入年、月直到正确为止
    {
   
        printf("Input year,month:");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值