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 PoolPipes
- {
- class Program
- {
- static void Main(string[] args)
- {
- var pool = int.Parse(Console.ReadLine());
- var pipe1 = int.Parse(Console.ReadLine());
- var pipe2 = int.Parse(Console.ReadLine());
- var hours = double.Parse(Console.ReadLine());
- var water = (pipe1 + pipe2) * hours;
- var percentOfpool = pool / 100;
- var fullPoolpercent = water / percentOfpool;
- var waterInpoolPercent = water / 100;
- var pipe1percent = (pipe1 * hours) / waterInpoolPercent;
- var pipe2percent = (pipe2 * hours) / waterInpoolPercent;
- if (water <= pool)
- {
- Console.WriteLine($"The pool is {fullPoolpercent}% full." +
- $" Pipe 1: {(int)pipe1percent}%. Pipe 2: {(int)pipe2percent}%.");
- }
- else if (water > pool)
- {
- Console.WriteLine($"For {hours} hours the pool overflows with {(water - pool):F1} liters.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement