Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Task 002, Chapter 3.1
- using System;
- public class PipesInPool
- {
- static void Main()
- {
- int volume = int.Parse(Console.ReadLine());
- int firstPipe = int.Parse(Console.ReadLine());
- int secondPipe = int.Parse(Console.ReadLine());
- double hours = double.Parse(Console.ReadLine());
- double water = (firstPipe + secondPipe) * hours;
- if(water < volume)
- {
- Console.WriteLine($"The pool is {Math.Truncate(water / volume * 100)}% full. " +
- $"Pipe 1: {Math.Truncate(firstPipe * hours / water * 100)}%. " +
- $"Pipe 2: {Math.Truncate(secondPipe * hours / water * 100)}%.");
- }
- else
- {
- Console.WriteLine($"For {hours} hours the pool overflows with {water - volume} liters.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment