Tech Study

C# Program to Convert Days to Years Weeks & Days

Introduction

C# Program to convert days to years, weeks and days. This program is compiled and tested on a Visual Studio 2012..

using System;

namespace TechStudyCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int days, years, weeks;
            Console.WriteLine("Enter days:");
            days = Convert.ToInt32( Console.ReadLine());

            years = (days / 365);
            weeks = (days % 365) / 7;
            days = days - ((years * 365) + (weeks * 7));

            Console.WriteLine("Years : "+ years);
            Console.WriteLine("weeks : "+ weeks);
            Console.WriteLine("Days : "+ days);
                    
            Console.ReadKey();
        }
    }
}

Result

C# Program to convert days to years, weeks and days
C# Program to convert days to years, weeks and days

 

Here are some more c# program for your practice:

C# Program to perform all arithmetic operations

C# program to print multiplication table of a given number

TaggedC++ Program to convert days to yearsweeks and days

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more