Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace _02.CenturiesToNanosec
- {
- class CenturiesToNanosec
- {
- static void Main(string[] args)
- {
- //Write program to enter an integer number of centuries and convert it to years, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds
- int centuries = int.Parse(Console.ReadLine());
- int years = centuries * 100;
- int days = (int)(years * 365.2422);
- int hours = days * 24;
- decimal minutes = hours * 60M;
- decimal seconds = minutes * 60M;
- decimal milliseconds = seconds * 1000M;
- decimal microseconds = milliseconds * 1000;
- decimal nanoseconds = microseconds * 1000;
- Console.WriteLine("{0} centuries = {1} years = {2} days = {3} hours = {4} minutes = {5} seconds = {6} milliseconds = {7} microseconds = {8} nanoseconds", centuries, years, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement