kirililchev3

Centuries to Nanoseconds

May 26th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace P10_CenturiesToNanosecond
  5. {
  6.     class Program
  7.     { // 365.2422
  8.         static void Main(string[] args)
  9.         {
  10.             byte centuries = byte.Parse(Console.ReadLine());
  11.             ushort years = (ushort)(centuries * 100);
  12.             int days = (int)(years * 365.2422);
  13.             int hours = days * 24;
  14.             long minutes = (long)hours * 60;
  15.             long seconds = minutes * 60;
  16.             ulong miliseconds = (ulong)seconds * 1000;
  17.             BigInteger microseconds = (BigInteger)miliseconds * 1000;
  18.             BigInteger nanoseconds = microseconds * 1000;
  19.  
  20.             Console.WriteLine($"{centuries} centuries = {years} years = {days} days = {hours} hours = {minutes}" +
  21.                 $" minutes = {seconds} seconds = {miliseconds} milliseconds = {microseconds} microseconds = {nanoseconds} nanoseconds");
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment