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