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

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more