Advertisement
koksibg

cleaning

Oct 27th, 2017
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace cleaning
  4. {
  5.     public class cleaning
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             double a = double.Parse(Console.ReadLine());
  10.             double b = double.Parse(Console.ReadLine());
  11.             double c = double.Parse(Console.ReadLine());
  12.             double d = double.Parse(Console.ReadLine());
  13.             double time = 1 / (1 / a + 1 / b + 1 / c);
  14.             double totalTime = time * 1.15;
  15.             double timeLeft = d - totalTime;
  16.             if (timeLeft > 0)
  17.             {
  18.                 Console.WriteLine($"Cleaning time: {totalTime:f2}");
  19.                 Console.WriteLine($"Yes, there is a surprise - time left -> {Math.Floor(timeLeft)} hours.");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"Cleaning time: {totalTime:f2}");
  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