ZKX's LAB

判断某年某月有多少天的c程序 C语言编程:输入某年某月某日,判断这一天是这一年的第几天?

2021-04-23知识2

C#判断某年某月共有多少个周末,分别是哪几天 假设周末2113是星期天,以下控制台程序判断某年某月共5261有多少个4102周末,并输入周末日期1653using System;namespace ConsolApplication1{class Program{static void Main(string[]args){Console.Write(\"输入年份:\");int year=int.Parse(Console.ReadLine());Console.Write(\"输入月份:\");int month=int.Parse(Console.ReadLine());某年某月的第一天DateTime t=new DateTime(year,month,1);记录周末数量int weekendCount=0;do{星期天为周末if(t.DayOfWeek=DayOfWeek.Sunday){weekendCount+;输入周末日期Console.WriteLine(t.ToString(\"yyyy年MM月dd日\"));}t=t.AddDays(1);} while(t.Month=month);输出周末数量Console.WriteLine(\"{0}年{1}月有{2}个周末\",year,month,weekendCount);按回车键退出程序Console.ReadLine();}}}

C语言如何判断某年某月有几天 C语言 2 一键分享 QQ空间 新浪微博 云收藏 人人网 腾讯微博 相册 开心网 腾讯朋友 贴吧 豆瓣网 搜狐微博 新首页 QQ好友 和讯微博 更多. 。

C语言编程:输入某年某月某日,判断这一天是这一年的第几天? 可以使用数组,并且使用数组代码更简洁一些,参考代码如下:#include?int?main(){?int?i,days=0;int?year,month,day;int?day_tab[13]={0,31,28,31,30,31,30,31,31,30。

#判断某年某月有多少天的c程序

随机阅读

qrcode
访问手机版