Guest User

Untitled

a guest
Feb 4th, 2019
1,458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. /*Write program to enter an integer number of centuries and
  2.  convert it to years, days, hours and minutes.
  3.  Output must be on one line.
  4.  Hints
  5.     • Use appropriate data type to fit the result
  6.     after each data conversion.
  7.     • Assume that a year has 365.2422 days at
  8.     average (the Tropical year).
  9.  __________________________________________________
  10.  INPUT                                     OUTPUT
  11.  1                           1 centuries = 100 years
  12.                              = 36524 days = 876576 hours
  13.                              = 52594560 minutes
  14.  __________________________________________________
  15.  5                           5 centuries = 500 years
  16.                              = 182621 days = 4382904 hours
  17.                              = 262974240 minutes          
  18. ____________________________________________________________
  19. */
  20. using System;
  21. using System.Numerics;
  22.  
  23. namespace _04CenturiesToMinutes
  24. {
  25.     class Program
  26.     {
  27.         static void Main(string[] args)
  28.         {
  29.             int centuries = int.Parse(Console.ReadLine());
  30.             int years = centuries * 100;
  31.             int days = (int)(years * 365.2422);
  32.             int hours = days * 24;
  33.             int minutes = hours * 60;
  34.  
  35.             Console.WriteLine("{0} centuries = {1} years = {2} days = {3} hours = {4} minutes", centuries, years, days, hours, minutes);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment