Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 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 _03ExercisesSwimmingWR
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double worldRecord = double.Parse(Console.ReadLine());
  14.             double razstoqnie = double.Parse(Console.ReadLine());
  15.             double secondsForMeter = double.Parse(Console.ReadLine());
  16.             double swimmingResult1 = razstoqnie * secondsForMeter;
  17.             double resistanceInSeconds = Math.Floor(razstoqnie / 15);
  18.             resistanceInSeconds *= 12.5;
  19.             double swimmingResult = swimmingResult1 + resistanceInSeconds;
  20.             double difference = Math.Abs(swimmingResult - worldRecord);
  21.             if (swimmingResult < worldRecord)
  22.             {
  23.             Console.WriteLine("Yes, he succeeded! The new world record is {0:f2} seconds.", swimmingResult);
  24.             }
  25.             else if (swimmingResult > worldRecord)
  26.             {
  27.             Console.WriteLine("No, he failed! He was {0:f2} seconds slower.", difference);
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement