Advertisement
Guest User

Untitled

a guest
May 29th, 2016
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 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. namespace _21.ConvertSpeedUnits
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. float distanceInMeters = float.Parse(Console.ReadLine());
  14. float hours = float.Parse(Console.ReadLine());
  15. float minutes = float.Parse(Console.ReadLine());
  16. float seconds = float.Parse(Console.ReadLine());
  17.  
  18. float totalSeconds = (hours + minutes / 60.0f) + (seconds / 3600.0f);
  19.  
  20. float metersPerSecond = (distanceInMeters / 1000) / totalSeconds;
  21. float kmPerHer = metersPerSecond / 3.6f;
  22. float milesPerHour = (distanceInMeters / 1609.0f) / totalSeconds;
  23.  
  24. Console.WriteLine("{0}", kmPerHer);
  25. Console.WriteLine("{0}", metersPerSecond);
  26. Console.WriteLine("{0}", milesPerHour);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement