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 pipesInPool
- {
- class pipesInPool
- {
- static void Main(string[] args)
- {
- var volumePool = double.Parse(Console.ReadLine());
- var debitPipe1 = double.Parse(Console.ReadLine());
- var debitPipe2 = double.Parse(Console.ReadLine());
- var hours = double.Parse(Console.ReadLine());
- var pulnotaPool = (debitPipe1 + debitPipe2)*hours;
- var pulnotaPoolProzent = pulnotaPool/volumePool*100;
- var prinosPipe1 = Math.Truncate((debitPipe1 / (debitPipe1+debitPipe2))*100); //Тук вместо Math.Round използваме Math.Truncate
- var prinosPipe2 = Math.Truncate((debitPipe2 / (debitPipe1 + debitPipe2))*100); //Тук вместо Math.Round използваме Math.Truncate
- if (pulnotaPool <= volumePool)
- {
- Console.WriteLine( "The pool is {0}% full." +
- " Pipe 1: {1}%. Pipe 2: {2}%.", (int)pulnotaPoolProzent, (int)prinosPipe1, (int)prinosPipe2); // Тук си кастваме по едно (int) отпред.
- }
- else if (pulnotaPool > volumePool)
- {
- var overflowsL = pulnotaPool - volumePool;
- Console.WriteLine("For {0} hours the pool overflows with {1} liters."
- ,hours, overflowsL);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement