SHARE
TWEET

Untitled

zmuletarova Sep 20th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top