Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace p02_Pool_pipes
- {
- class Program
- {
- static void Main()
- {
- int volume = int.Parse(Console.ReadLine());
- int flowP1 = int.Parse(Console.ReadLine());
- int flowP2 = int.Parse(Console.ReadLine());
- double hours = double.Parse(Console.ReadLine());
- double volP1 = hours * flowP1;
- double volP2 = hours * flowP2;
- double poolFilled = volP1 + volP2;
- if (poolFilled <= volume) // particulary filled
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", Math.Floor(poolFilled/volume*100),
- Math.Floor(volP1/poolFilled*100),
- Math.Floor(volP2 / poolFilled * 100));
- }
- else // over filled
- {
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, (poolFilled-volume));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment