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 Pipes
- {
- 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 p1h =p1*h;
- var p2h = p2 * h;
- var pipeResult = p1h + p2h;
- var percentP1 = Math.Truncate((p1h / pipeResult)*100);
- var percentP2 = Math.Truncate((p2h / pipeResult)*100);
- var vResult = Math.Truncate((pipeResult / v)*100);
- if(pipeResult>v)
- {
- Console.WriteLine("For {0:} hours the pool overflows with {1:} liters.",h,pipeResult-v);
- }
- if(pipeResult<=v)
- {
- Console.WriteLine("The pool is {0:}% full. Pipe 1: {1:}%. Pipe 2: {2:}%.",vResult,percentP1,percentP2);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment