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 PoolPippes
- {
- class Program
- {
- static void Main(string[] args)
- {
- var volume = ushort.Parse(Console.ReadLine());
- var p1 = ushort.Parse(Console.ReadLine());
- var p2 = ushort.Parse(Console.ReadLine());
- var hours = float.Parse(Console.ReadLine());
- var totalP1 = p1 * hours;
- var totalp2 = p2 * hours;
- var totalPipe = totalP1 + totalp2;
- var procentP1 = Math.Floor((totalP1 * 100 / totalPipe));
- var procentp2 = Math.Floor((totalp2 * 100 / totalPipe));
- var procentTotal = Math.Floor(totalPipe * 100 / volume);
- if (totalPipe <= volume)
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",
- procentTotal,
- procentP1,
- procentp2);
- }
- else
- {
- var overflows = totalPipe - volume;
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.",
- hours,
- overflows);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement