Advertisement
veronikaaa86

swimming word record

Jan 17th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 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 trytodothebest
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var record = double.Parse(Console.ReadLine());
  14.             var distance = double.Parse(Console.ReadLine());
  15.             var timeToSec = double.Parse(Console.ReadLine());
  16.  
  17.             var swims = distance * timeToSec;
  18.             var timewith15secs = Math.Floor(distance / 15) * 12.5;
  19.             var allTime = (swims + timewith15secs);
  20.  
  21.             if (record <= allTime)
  22.             {
  23.                
  24.                 Console.WriteLine($"No, he failed! He was {allTime - record:f2} seconds slower.");
  25.                
  26.  
  27.             }
  28.             else if (record > allTime)
  29.             {
  30.                
  31.                 Console.WriteLine($"Yes, he succeeded! The new world record is {allTime:f2} seconds.");
  32.             }
  33.            
  34.  
  35.            
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement