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