f0rc3ful

06. World Swimming Record

Mar 25th, 2023
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HelloSoftUni
  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 delay = Math.Round(distance / 15, 0);
  12. double ivanTime = (double.Parse(Console.ReadLine()) * distance) + (delay * 12.5);
  13.  
  14. if (ivanTime < recordTime)
  15. {
  16. Console.WriteLine($"Yes, he succeeded! The new world record is {ivanTime:F2} seconds.");
  17. }
  18. else
  19. {
  20. Console.WriteLine($"No, he failed! He was {(ivanTime - recordTime):F2} seconds slower.");
  21. }
  22.  
  23. }
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment