Advertisement
YORDAN2347

WorldSwimingRecord

Nov 16th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. using System;
  2.  
  3. namespace WorldSwimmingRecord
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double recordTime = double.Parse(Console.ReadLine());
  10. double distance = double.Parse(Console.ReadLine());
  11. double meterSwimsPerSec = double.Parse(Console.ReadLine());
  12.  
  13. double newTime = distance * meterSwimsPerSec;
  14. double slowing = Math.Floor(distance / 15 * 12.5);
  15. Console.WriteLine($"slowing is: {slowing}");
  16. newTime += slowing;
  17.  
  18. bool isGreater = newTime < recordTime;
  19. if (isGreater)
  20. {
  21. Console.WriteLine($"Yes, he succeeded! The new world record is {newTime:f2} seconds.");
  22. }
  23. else
  24. {
  25. Console.WriteLine($"No, he failed! He was {(newTime - recordTime):f2} seconds slower.");
  26. }
  27. }
  28. }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement