C# program to convert days into years, weeks and days
In this C# program, we will take the input (days) from the user and Convert days into years, weeks and days.
C# program to Convert days into years, weeks and days Code:
private static void Main(string[] args)
{
int ndays, year, week, days;
Console.Write("Enter the number of days: ");
ndays = int.Parse(Console.ReadLine());
year = ndays / 365;
week = (ndays % 365) / 7;
days = (ndays % 365) % 7;
Console.WriteLine("{0} days is equal to {1} year, {2} weeks and {3} days",
ndays, year, week, days);
Console.ReadLine();
}
C# program to Convert days into years, weeks and days Output: