Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class PoolPipes
- {
- static void Main(string[] args)
- {
- int volumeOfThePool = int.Parse(Console.ReadLine());
- int firstPipeDebit = int.Parse(Console.ReadLine());
- int secondPipeDebit = int.Parse(Console.ReadLine());
- double hours = double.Parse(Console.ReadLine());
- double firstFilledPipe = hours * firstPipeDebit;
- double secondFilledPipe = hours * secondPipeDebit;
- double filledPool = (firstFilledPipe + secondFilledPipe);
- double percentageFilledPool = (filledPool / volumeOfThePool) * 100;
- double perecentageFilledFirstPipe = (firstFilledPipe / filledPool) * 100;
- double percentageFilledSecondPipe = (secondFilledPipe / filledPool) * 100;
- if (filledPool <= volumeOfThePool)
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", (int)(percentageFilledPool), (int)(perecentageFilledFirstPipe), (int)(percentageFilledSecondPipe));
- }
- else
- {
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, filledPool - volumeOfThePool);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement