Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PoolPipes
- {
- class Program
- {
- public static void Main(string[] args)
- {
- int poolVolume = int.Parse(Console.ReadLine());
- int pipe1 = int.Parse(Console.ReadLine());
- int pipe2 = int.Parse(Console.ReadLine());
- double hoursWithoutWorkers = double.Parse(Console.ReadLine());
- double inputPipe1 = (double)pipe1 * hoursWithoutWorkers;
- double inputPipe2 = (double)pipe2 * hoursWithoutWorkers;
- double totalInputs = inputPipe1 + inputPipe2;
- if(totalInputs <= poolVolume)
- {
- double percentInput = (totalInputs / (double)poolVolume) * 100.0;
- double percentInputPipe1 = (inputPipe1 / (double)totalInputs) * 100.0;
- double percentInputPipe2 = (inputPipe2 / (double)totalInputs) * 100.0;
- Console.WriteLine("The pool is {0:f0}% full. Pipe 1: {1:f0}%. Pipe 2: {2:f0}%.", Math.Floor(percentInput), Math.Floor(percentInputPipe1),
- Math.Floor(percentInputPipe2));
- }
- else if(totalInputs > poolVolume)
- {
- double totalOverflow = totalInputs - poolVolume;
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hoursWithoutWorkers, totalOverflow);
- }
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement