Advertisement
Spocoman

06. World Swimming Record

Nov 16th, 2021 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SwimmingRecords
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double record = double. Parse(Console.ReadLine());
  10.             double distance = double.Parse(Console.ReadLine());
  11.             double secondsToMeter = double.Parse(Console.ReadLine());
  12.  
  13.             double score = distance * secondsToMeter + Math.Floor (distance / 15) * 12.5;
  14.            
  15.             if (score >= record)
  16.             {
  17.                 Console.WriteLine($"No, he failed! He was {score - record:F2} seconds slower.");
  18.             }
  19.             else
  20.             {
  21.                 Console.WriteLine($"Yes, he succeeded! The new world record is {score:F2} seconds.");
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement