Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int V = int.Parse(Console.ReadLine());
- int P1 = int.Parse(Console.ReadLine());
- int P2 = int.Parse(Console.ReadLine());
- double H = double.Parse(Console.ReadLine());
- int filled = (int)((P1 + P2) * H);
- int percentFilled = filled * 100 / V;
- int p1Percent = (int)(P1 * H / filled * 100);
- int p2Percent = (int)(P2 * H / filled * 100);
- if (percentFilled <= 100)
- {
- Console.WriteLine($"The pool is {percentFilled}% full. Pipe 1: {p1Percent}%. Pipe 2: {p2Percent}%");
- }
- else
- {
- Console.WriteLine($"For {H} hours the pool overflows with {(P1 + P2)*H - V} liters.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement