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;
- namespace TravellingAtLightSpeed
- {
- class TravellingAtLightSpeed
- {
- static void Main(string[] args)
- {
- decimal lightYears = decimal.Parse(Console.ReadLine());
- decimal time = lightYears * 9450000000000 / 300000;
- decimal weeks = time / 60 / 60 / 24 / 7;
- decimal weeksFormated = Math.Floor(weeks);
- decimal days = (weeks - weeksFormated) * 7;
- decimal daysFormated = Math.Floor(days);
- decimal hours = (days - daysFormated) * 24;
- decimal hoursFormated = Math.Floor(hours);
- decimal minutes = (hours - hoursFormated) * 60;
- decimal minutesFormated = Math.Floor(minutes);
- decimal seconds = (minutes - minutesFormated) * 60;
- decimal secondsFormated = Math.Floor(seconds);
- Console.WriteLine($"{weeksFormated} weeks");
- Console.WriteLine($"{daysFormated} days");
- Console.WriteLine($"{hoursFormated} hours");
- Console.WriteLine($"{minutesFormated} minutes");
- Console.WriteLine($"{secondsFormated} seconds");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment