Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01.PipesInPool
- {
- class Program
- {
- static void Main(string[] args)
- {
- 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 p1Lit = p1 * h;
- double p2Lit = p2 * h;
- double totalWater = p1Lit + p2Lit;
- double fullPoolPercentage = (totalWater * 100) / v;
- double p1Percentage = (p1Lit * 100) / totalWater;
- double p2Percentage = (p2Lit * 100) / totalWater;
- if (v >= totalWater)
- {
- Console.WriteLine($"The pool is {fullPoolPercentage}% full. Pipe 1: {p1Percentage}%. Pipe 2: {p2Percentage}%.");
- }
- else
- {
- double overflows = totalWater - v;
- Console.WriteLine($"For {h} hours the pool overflows with {overflows} liters.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement