Advertisement
Vladimir76

Convert Speed

Jan 20th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 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 Convert_speed_Units
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             double dist = double.Parse(Console.ReadLine());
  14.             double hours = double.Parse(Console.ReadLine());
  15.             double mins = double.Parse(Console.ReadLine());
  16.             double secs = double.Parse(Console.ReadLine());
  17.  
  18.             float toSeconds = (float)((hours * 60) * 60 + mins * 60 + secs);
  19.             float meterSec = (float)(dist / toSeconds);
  20.  
  21.             float kms = (float)(dist / 1000);
  22.             float toHours = (float)(hours + (mins / 60) + (secs / 60) / 60);
  23.             float kilomHour = kms / toHours;
  24.  
  25.             float milesHours = kilomHour / 1.609f;
  26.  
  27.             Console.WriteLine("{0}", meterSec);
  28.             Console.WriteLine("{0}", kilomHour);
  29.             Console.WriteLine("{0}", milesHours);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement