Console.Write("你要输入的天数:");
int days = Convert.ToInt32(Console.ReadLine());
int month = days / 30;
int mod = days%30; //days中的天数除去月份所占用的天数,还剩多少天。
int week =mod/7 ;
int day = mod % 7;
Console.WriteLine("{0}共有{1}月{2}周{3}天", day, month, week, day);
Console.ReadLine();
#region 编程实现107653秒是几天几小时几分钟几秒?
int seconds = 107653;
int s=24*60*60;
int days = seconds / s;
int hours = seconds % s/(60*60);
int mins = (seconds % s) % (60 * 60)/60;
int secs=(seconds%s)%(60*60)%60;
Console.WriteLine("107453秒是{0}天{1}小时{2}分钟{3}秒", days, hours, mins,secs);
Console.ReadKey();
#endregion
Console.WriteLine("请输入年份:");
int year=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入月份:");
int month=Convert.ToInt32(Console.ReadLine());
bool isnet= (year%400== 0 )||((year%4==0)&&(year%100!=0));
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
Console.WriteLine("31天");
break;
case 2:
if(isnet )
{
Console.WriteLine("29天");
}
else
{
Console.WriteLine("28天");
}
break;
default:
Console.WriteLine("30天");
break;