Advertisement
Spocoman

Three brothers

Oct 9th, 2023 (edited)
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace  ThreeBrothers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double firstTime = double.Parse(Console.ReadLine());
  10.             double secondTime = double.Parse(Console.ReadLine());
  11.             double thirdTime = double.Parse(Console.ReadLine());
  12.             double fatherTime = double.Parse(Console.ReadLine());
  13.  
  14.             double cleaningTime = 1 / (1 / firstTime + 1 / secondTime + 1 / thirdTime) * 1.15;
  15.             double timeLeft = fatherTime - cleaningTime;
  16.  
  17.             Console.WriteLine($"Cleaning time: {cleaningTime:f2}");
  18.             if (timeLeft > 0)
  19.             {
  20.                 Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Floor(timeLeft)} hours.");
  21.             }
  22.             else
  23.             {
  24.                 Console.WriteLine($"No, there isn't a surprise - shortage of time -> {Math.Ceiling(Math.Abs(timeLeft))} hours.");
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement