Advertisement
koksibg

Centuries_to_Nanoseconds

Oct 7th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. namespace Centuries_to_Nanoseconds
  9. {
  10.     class Centuries_to_Nanoseconds
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int centuries = int.Parse(Console.ReadLine());
  15.             int years = centuries * 100;
  16.             int days = (int)(years * 365.2422);
  17.             int hours = days * 24;
  18.             long minutes = hours * 60;
  19.             ulong seconds = (ulong)minutes * 60;
  20.             ulong milliseconds = seconds * 1000;
  21.             decimal microseconds = milliseconds * 1000;
  22.             decimal nanoseconds = microseconds * 1000;
  23.             Console.Write($"{centuries} centuries = ");
  24.             Console.Write($"{years} years = ");
  25.             Console.Write($"{days} days = ");
  26.             Console.Write($"{hours} hours = ");
  27.             Console.Write($"{minutes} minutes = ");
  28.             Console.Write($"{seconds} seconds = ");
  29.             Console.Write($"{milliseconds} milliseconds = ");
  30.             Console.Write($"{microseconds} microseconds = ");
  31.             Console.Write($"{nanoseconds} nanoseconds");
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement