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 TubesInPool
- {
- class Program
- {
- static void Main(string[] args)
- {
- var v = int.Parse(Console.ReadLine());
- var p1 = int.Parse(Console.ReadLine());
- var p2 = int.Parse(Console.ReadLine());
- var h = double.Parse(Console.ReadLine());
- var water = p1 * h + p2 * h;
- var waterPercent = water * 100 / v;
- waterPercent = Math.Truncate(waterPercent);
- var percentP1=(p1*h*100) / water;
- percentP1 = Math.Truncate(percentP1);
- var percentP2 = (p2*h*100) / water;
- percentP2 = Math.Truncate(percentP2);
- var overflow = water - v;
- if (water<=v)
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",waterPercent,percentP1,percentP2);
- else
- Console.WriteLine("For {0} hours the pool overflows with {1,0:f1} liters.",h,overflow);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment