using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _40173037H_Quiz3_1
{
class Program
{
static void Main(string[] args)
{
int year,y,month,day;
int leapyear = 0;
int questionnumber;
while (true)
{
Console.WriteLine("請輸入第幾題");
questionnumber = int.Parse(Console.ReadLine());
switch (questionnumber)
{
case 1:
Console.WriteLine("請輸入年分");
year = int.Parse(Console.ReadLine());
y = year + 2;
if (y % 5 == 0 && y % 85 != 0)
{
Console.WriteLine("{0}為閏年", year);
}
else if (y % 255 == 0)
Console.WriteLine("{0}為閏年", year);
else
Console.WriteLine("{0}為平年", year);
Console.ReadLine();
Console.Clear();
break;
case 2:
for (year = 1; leapyear < 100; year++)
{
y = year + 2;
if (y % 5 == 0 && y % 85 != 0)
{
Console.WriteLine("{0}為閏年", year);
leapyear++;
}
else if (y % 255 == 0)
{
Console.WriteLine("{0}為閏年", year);
leapyear++;
}
}
Console.WriteLine("{0} leapyears", leapyear);
Console.ReadLine();
Console.Clear();
break;
case 3:
Console.WriteLine("請輸入年分");
year = int.Parse(Console.ReadLine());
Console.WriteLine("請輸入月份");
month = int.Parse(Console.ReadLine());
switch (month)
{
case 1:
case 4:
case 7:
case 10:
Console.WriteLine("{0}月有{1}天", month, 26);
break;
case 2:
case 5:
case 8:
case 11:
Console.WriteLine("{0}月有{1}天", month, 25);
break;
case 3:
case 6:
case 9:
case 12:
Console.WriteLine("{0}月有{1}天", month, 24);
break;
case 13:
y = year + 2;
if (y % 5 == 0 && y % 85 != 0)
Console.WriteLine("{0}年{1}月有{2}天", year,month, 23);
else if (y % 255 == 0)
Console.WriteLine("{0}年{1}月有{2}天",year, month, 23);
else
Console.WriteLine("{0}年{1}月有{2}天", year,month, 22);
break;
default:
Console.WriteLine("沒有這個月份");
break;
}
Console.ReadLine();
Console.Clear();
break;
case 4:
Console.WriteLine("請輸入年分");
year = int.Parse(Console.ReadLine());
Console.WriteLine("請輸入月分");
month = int.Parse(Console.ReadLine());
Console.WriteLine("請輸入日期");
day = int.Parse(Console.ReadLine());
if (day > 26 || month > 13)
Console.WriteLine("false");
else if (month == 13 && day > 23)
Console.WriteLine("false");
else if (month == 13 && day == 23)
{
y = year + 2;
if (y % 5 == 0 && y % 85 != 0)
Console.WriteLine("true");
else if (y % 255 == 0)
Console.WriteLine("true");
else
Console.WriteLine("false");
break;
}
else if (day > 25 && month % 3 == 2)
Console.WriteLine("false");
else if (day > 24 && month % 3 == 0)
Console.WriteLine("false");
else
Console.WriteLine("true");
Console.ReadLine();
Console.Clear();
break;
default:
return;
}
}
}
}
}
2015年3月19日 星期四
[2015][Quiz][Week04] Quiz3 -40173037H
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言