In this C# tutorial we are "converting given no of days entered by the user into years, weeks and days" . Here we are taking three variables "y" for years ,"d" for days and "w" for weeks respectively. Now, lets get started!!
using System;
class prg
{
public static void Main(String []args)
{
int y,d,w;
Console.WriteLine("Enter no of days : ");
d=Convert.ToInt32(Console.ReadLine());
y=d/365;
d=d%365;
w=d/7;
d=d%7;
Console.WriteLine("Years =" + y + "Weeks =" + w + "Days =" + d);
}
}
0 comments:
Post a Comment