The source code to change the case of entered character is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
//C# program to convert entered days into years, weeks, and days.
using System;
class Sample
{
static void Main(string[] args)
{
int num =0;
int years =0;
int weeks =0;
int days =0;
Console.Write("Enter number of days: ");
num = Convert.ToInt32(Console.ReadLine());
years = num / 365;
weeks = (num % 365) / 7;
days = (num % 365) % 7;
Console.WriteLine("Years : " + years);
Console.WriteLine("Weeks : " + weeks);
Console.WriteLine("Days : " + days );
}
}
Output:
Enter number of days: 768
Years : 2
Weeks : 5
Days : 3
Press any key to continue . . .
Explanation:
In the above program, we created a class Sample that contains the Main() method. In the Main() method, we read the number of days from the keyboard.
years = num / 365;
weeks = (num % 365) / 7;
days = (num % 365) % 7;
In the above code we converted entered number of days into years, weeks, and days and then print the result on the console screen.
Program:
The source code to change the case of entered character is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
In the above program, we created a class Sample that contains the Main() method. In the Main() method, we read the number of days from the keyboard.
In the above code we converted entered number of days into years, weeks, and days and then print the result on the console screen.