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 Pipes_in_the_pool
- {
- class Program
- {
- static void Main(string[] args)
- {
- var maxVolume = int.Parse(Console.ReadLine());
- var p1 = int.Parse(Console.ReadLine());
- var p2 = int.Parse(Console.ReadLine());
- var hours = double.Parse(Console.ReadLine());
- double volumeP1 = p1 * hours;
- double volumeP2 = p2 * hours;
- double volumeTotal = volumeP1 + volumeP2;
- double overflow = volumeTotal - maxVolume;
- double percentP1 = Math.Floor(volumeP1 / volumeTotal * 100);
- double percentP2 = Math.Floor(volumeP2 / volumeTotal * 100);
- double percentTotal = Math.Floor(volumeTotal / maxVolume * 100);
- if (volumeTotal <= maxVolume)
- {
- Console.WriteLine($"The pool is {percentTotal}% full. " +
- $"Pipe 1: {percentP1}%. Pipe 2: {percentP2}%.");
- }
- else
- {
- Console.WriteLine($"For {hours} hours the pool overflows " +
- $"with {overflow:f1} liters.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement