class Program
{
static void Main(string[] args)
{
Console.Write("Enter the year: ");
int year = int.Parse(Console.ReadLine());
Console.Write("Enter the month(number): ");
int month = int.Parse(Console.ReadLine());
Console.Write("Enter the day: ");
int day = int.Parse(Console.ReadLine());
Console.WriteLine($"The number of days elapsed since 14th August 1947 to the provided date is {num_indep_days(day, month, year)}");
Console.Write("Press any key to close app...");
Console.ReadKey();
}
public static int num_indep_days(int day, int month, int year)
{
DateTime date = new DateTime(1947, 08, 14),
providedDate = new DateTime(year, month, day);
return (int)Math.Floor((providedDate - date).TotalDays);
}
}
Comments
Leave a comment