Advertisement
zmuletarova

Untitled

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