Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace pipes
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- var litPool = int.Parse(Console.ReadLine());
- var p1 = int.Parse(Console.ReadLine());
- var p2 = int.Parse(Console.ReadLine());
- double hoursMiss = double.Parse(Console.ReadLine());
- var water = p1 * hoursMiss + p2 * hoursMiss;
- if(water <= litPool){
- var percentOfWater = Math.Truncate (water / litPool * 100);
- var percentFirtPipe = Math.Truncate (p1 * hoursMiss / water * 100);
- var secondPipePercent = Math.Truncate (p2 * hoursMiss / water * 100);
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",percentOfWater, percentFirtPipe, secondPipePercent);
- }
- else{
- var overflow = water - litPool;
- Console.WriteLine("For {0:0.0} hours the pool overflows with {1:0.0} liters.", hoursMiss, overflow);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement