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 PoolPipes
- {
- class Program
- {
- static void Main(string[] args)
- {
- int volume = int.Parse(Console.ReadLine());
- int pipe1 = int.Parse(Console.ReadLine());
- int pipe2 = int.Parse(Console.ReadLine());
- double hours = double.Parse(Console.ReadLine());
- var pipeFlow1 = pipe1 * hours;
- var pipeFlow2 = pipe2 * hours;
- var water = Math.Floor(pipeFlow1 + pipeFlow2);
- var poolFull = water * 100 / volume;
- var partPipe1 = pipeFlow1 * 100 / water;
- var partPipe2 = pipeFlow2 * 100 / water;
- var overflow = Math.Floor(water - volume);
- if (overflow > 0)
- {
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, overflow);
- }
- else
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", Math.Floor(poolFull), Math.Floor(partPipe1), Math.Floor(partPipe2));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment