Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 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 worldSwimmingRecord
  8. {
  9. class worldSwimmingRecord
  10. {
  11. static void Main(string[] args)
  12. {
  13. double record = double.Parse(Console.ReadLine());
  14. double distance = double.Parse(Console.ReadLine());
  15. double secsPerMeter = double.Parse(Console.ReadLine());
  16.  
  17. var time = distance * secsPerMeter;
  18. var waterDrag = Math.Floor(distance / 15) * 12.5;
  19. var allTime = time+waterDrag;
  20.  
  21. if (allTime<record)
  22. {
  23. Console.WriteLine(" Yes, he succeeded! The new world record is {0:f2} seconds.",allTime);
  24. }
  25. else
  26. {
  27. Console.WriteLine("No, he failed! He was {0:f2} seconds slower.",allTime-record);
  28. }
  29.  
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement