Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PipesInPool
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int volumeInLitres = int.Parse(Console.ReadLine());
  10.             int pipe1 = int.Parse(Console.ReadLine());
  11.             int pipe2 = int.Parse(Console.ReadLine());
  12.             double hours = double.Parse(Console.ReadLine());
  13.  
  14.             double litresForHours = (pipe1 + pipe2) * hours;
  15.             double percentLitres = litresForHours / 1000 * 100;
  16.             double percentPipe1 = pipe1 * hours / litresForHours * 100;
  17.             double percentPipe2 = pipe2 * hours / litresForHours * 100;
  18.  
  19.             if (volumeInLitres > litresForHours)
  20.             {
  21.                 Console.WriteLine($"The pool is {percentLitres:F2}% full. Pipe 1: {percentPipe1:F2}%. Pipe 2: {percentPipe2:F2}%.");
  22.             }
  23.             else if (litresForHours > volumeInLitres)
  24.             {
  25.                 Console.WriteLine($"For {hours:F2} hours the pool overflows with {litresForHours - volumeInLitres:F2} liters.");
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement