0% found this document useful (0 votes)
7 views1 page

Untitled Document

Uploaded by

noamgolds74
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Untitled Document

Uploaded by

noamgolds74
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Console.

WriteLine("Choose year");
int year = int.Parse(Console.ReadLine());
Console.WriteLine("Choose a day");
int day = int.Parse(Console.ReadLine());
Console.WriteLine("Choose Month");
int month = int.Parse(Console.ReadLine());

switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
{
if (day > 31 || day < 0)
Console.WriteLine("Date is not valid");
else
Console.WriteLine("Date is valid");
} break;
case 4:
case 6:
case 9:
case 11:
if (day > 30 || day < 0)
Console.WriteLine("Date is not valid");
else
Console.WriteLine("Date is valid");
break;
case 2:
if ((year % 4 == 0 && year % 100 != 0 || year % 400 == 0) && day <= 28 && day >
0)
Console.WriteLine("Date is valid");
else if ((year % 4 != 0 && year % 100 == 0 || year % 400 != 0) && day <= 29 && day
> 0)
Console.WriteLine("Date is valid");
else Console.WriteLine("Date isn't valid");
break;

You might also like