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 _02.PoolPipes
- {
- class Program
- {
- static void Main(string[] args)
- {
- var VPool = int.Parse(Console.ReadLine());
- var p1For1Hour = int.Parse(Console.ReadLine());
- var p2For1Hour = int.Parse(Console.ReadLine());
- var missingHours = double.Parse(Console.ReadLine());
- var totalFirstPipe = p1For1Hour * missingHours;
- var totalSecondPipe = p2For1Hour * missingHours;
- var totalPipeLiters = totalFirstPipe + totalSecondPipe;
- if (VPool>= totalPipeLiters)
- {
- var percentagePoolFill = (totalPipeLiters / VPool) * 100;
- var percentageFirstPipe = (totalFirstPipe / totalPipeLiters) * 100;
- var percentageSecondPipe = (totalSecondPipe / totalPipeLiters) * 100;
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",
- Math.Truncate(percentagePoolFill), Math.Truncate(percentageFirstPipe), Math.Truncate(percentageSecondPipe/1));
- }
- else
- {
- var overflowing = totalPipeLiters - VPool;
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.",
- missingHours, overflowing);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement