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:

CSharp-program-to-convert-days-into-years-weeks-and-days

 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
5 + 1 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2022 CodingFusion
75 Important SQL Server queries you should know