VelizarAvramov

10. Centuries to Nanoseconds

Nov 28th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace _10._Centuries_to_Nanoseconds
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             byte centures = byte.Parse(Console.ReadLine());
  11.  
  12.             ushort years = (ushort)(centures * 100);
  13.             int days = (int)(years * 365.2422);
  14.             int hours = days * 24;
  15.             long minutes = hours * 60;
  16.             long seconds = minutes * 60;
  17.             BigInteger miliseconds = seconds * 1000;
  18.             BigInteger microseconds = miliseconds * 1000;
  19.             BigInteger nanoseconds = microseconds * 1000;
  20.  
  21.             Console.WriteLine($"{centures} centuries = {years} years = {days} days = {hours} hours = {minutes} minutes = {seconds} seconds = {miliseconds} milliseconds = {microseconds} microseconds = {nanoseconds} nanoseconds");
  22.  
  23.  
  24.             //int centures = int.Parse(Console.ReadLine());
  25.  
  26.             //int years = centures * 100;
  27.             //int days = (int)(years * 365.2422);
  28.             //int hours = days * 24;
  29.             //long mins = hours * 60;
  30.             //long seconds = mins * 60;
  31.             //decimal milisec = seconds * 1000;
  32.             //decimal microsec = milisec * 1000;
  33.             //decimal nanosec = microsec * 1000;
  34.  
  35.             //Console.WriteLine($"{centures} centuries = {years} years = {days} days = {hours} hours = {mins} minutes = {seconds} seconds = {milisec} milliseconds = {microsec} microseconds = {nanosec} nanoseconds");
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment