You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
675 B
C#

/*
* C# Program to Convert a Given Number of Days in terms of
* Years, Weeks & Days
*/
using System;
class program
{
public static void Main()
{
int ndays, year, week, days, DAYSINWEEK=7;
Console.WriteLine("Enter the number of days");
ndays = int.Parse(Console.ReadLine());
year = ndays / 365;
week = (ndays % 365) / DAYSINWEEK;
days = (ndays % 365) % DAYSINWEEK;
Console.WriteLine("{0} is equivalent to {1}years, {2}weeks and {3}days", ndays, year, week, days);
Console.ReadLine();
}
}
/*
Enter the number of days
1000
1000 is equivalent to 2 years, 38 weeks and 4 days