Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp10
- {
- class Program
- {
- static void Main(string[] args)
- {
- int Vol = int.Parse(Console.ReadLine());
- int P1 = int.Parse(Console.ReadLine());
- int P2 = int.Parse(Console.ReadLine());
- double H = double.Parse(Console.ReadLine());
- double P1water = H * P1;
- double P2water = H * P2;
- double TotalWater = P1water + P2water;
- double WaterPerc = TotalWater / Vol * 100;
- double P1Per = P1water / TotalWater * 100;
- double P2Perc = P2water / TotalWater * 100;
- if (TotalWater <= Vol)
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", Math.Truncate(WaterPerc), Math.Truncate(P1Per),
- Math.Truncate(P2Perc));
- }
- else if (TotalWater > Vol)
- {
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", H, ($"{TotalWater - Vol:f1}"));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement