Write C# Program to Convert Days into Years, Weeks and Days

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading;

using System.Threading.Tasks;

using System.Xml;


namespace ConsoleApp

{

    class Program

    {

        static void Main(string[] args)

        {

            int NumOfdays, year, week, days, DaysInWeek = 7;

            Console.Write("Enter the number of days : ");

            NumOfdays = Convert.ToInt32(Console.ReadLine());

            year = NumOfdays / 365;

            week = (NumOfdays % 365) / DaysInWeek;

            days = (NumOfdays % 365) % DaysInWeek;

            Console.WriteLine("years = " +year);

            Console.WriteLine("weeks = " +week);

            Console.WriteLine("days = " +days);

            Console.ReadKey();


        }

    }

}


Output:-

Enter the number of days : 432

years = 1

weeks = 9

days = 4


एक टिप्पणी भेजें

0 टिप्पणियाँ