Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int years;
- int months;
- int days;
- Console.WriteLine("inserd date in this formad dd/mm/yyyy: ");
- Console.WriteLine("Days: ");
- days = int.Parse(Console.ReadLine());
- Console.WriteLine("Months: ");
- months = int.Parse(Console.ReadLine());
- Console.WriteLine("Years: ");
- years = int.Parse(Console.ReadLine());
- int dayz;
- switch (months)
- {
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:
- dayz = 31;
- break;
- case 4:
- case 6:
- case 9:
- case 11:
- dayz = 30;
- break;
- case 2:
- if (((years % 4 == 0) && !(years % 100 == 0)) || (years % 400 == 0))
- dayz = 29;
- else dayz = 28;
- break;
- default: Console.WriteLine("Not Valid Month!");
- dayz = 0;
- break;
- }
- Console.WriteLine("Number Of Days: " + days);
- if (years <= 9999 && years >= 0 && months >= 1 && months <= 12 && days >= 1 && days <= 31)
- Console.WriteLine("date inserted correctly");
- else
- {
- Console.WriteLine("date inserted incorrect");
- }
- if (months == 1 || months == 3 || months == 5 || months == 7 || months == 8 || months == 10 || months == 12)
- Console.WriteLine("Number of days untill end of month: " + (31 - days));
- if (months == 1)
- Console.WriteLine("Number of days untill end of year: " + (364 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/2/ " + years);
- else
- Console.WriteLine("The next day: " + (days+1) + "/1/" + years);
- if (months == 2)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - days));
- if (days == dayz)
- Console.WriteLine("The next day: 1/3/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/2/" + years);
- if (months == 3)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/4/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/3/" + years);
- if (months == 4)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - days));
- if (days == 30)
- Console.WriteLine("The next day: 1/5/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/4/" + years);
- if (months == 5)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/6/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/5/" + years);
- if (months == 6)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - days));
- if (days == 30)
- Console.WriteLine("The next day: 1/7/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/6/" + years);
- if (months == 7)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/8/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/7/" + years);
- if (months == 8)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/9/ " + years);
- else
- Console.WriteLine("The next day: " + (days+1) + "/8/" + years);
- if (months == 9)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - days));
- if (days == 30)
- Console.WriteLine("The next day: 1/10/ " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/9/" + years);
- if (months == 10)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/11 " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/10/" + years);
- if (months == 11)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - 30 - days));
- if (days == 30)
- Console.WriteLine("The next day: 1/12 " + years);
- else
- Console.WriteLine("The next day: " + (days + 1) + "/11/" + years);
- if (months == 12)
- Console.WriteLine("Number of days untill end of year: " + (364 - 31 - dayz - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - 30 - 31 - days));
- if (days == 31)
- Console.WriteLine("The next day: 1/1/ " + (years + 1));
- else
- Console.WriteLine("The next day: " + (days + 1) + "/12/" + years);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement