Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int v = int.Parse(Console.ReadLine());
- int p1 = int.Parse(Console.ReadLine());
- int p2 = int.Parse(Console.ReadLine());
- double h = double.Parse(Console.ReadLine());
- double volumeP1 = p1 * h;
- double volumeP2 = p2 * h;
- double totalVolume = volumeP1 + volumeP2;
- int percentFull= (int)(totalVolume / v * 100);
- int percentP1 = (int)(volumeP1 / totalVolume * 100);
- int percentP2 = (int)(volumeP2 / totalVolume * 100);
- if (totalVolume <= v)
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", percentFull, percentP1, percentP2);
- }
- else
- {
- double overflow = (totalVolume - v);
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.",h,overflow);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement