Advertisement
VickSuna

Untitled

Feb 17th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _331_Pipes_In_Pool
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int volumePool = int.Parse(Console.ReadLine());
  10. int debitPipe1 = int.Parse(Console.ReadLine());
  11. int debitPipe2 = int.Parse(Console.ReadLine());
  12. double hours = double.Parse(Console.ReadLine());
  13.  
  14. double poolState = ((debitPipe1 * hours) + (debitPipe2 * hours)); //колко е пълен басейна
  15. if (poolState <= volumePool)
  16. {
  17. double PrinosPipe1 = debitPipe1 * hours / poolState * 100; // принос на първа тръба
  18. double PrinosPipe2 = debitPipe2 * hours / poolState * 100; // принос на втора тръба
  19.  
  20. Console.WriteLine($"The pool is {poolState/volumePool *100:F2}% full. Pipe 1: {PrinosPipe1:F2}%. Pipe 2:{PrinosPipe2:F2}%.");
  21.  
  22. }
  23. else if (poolState > volumePool)
  24. {
  25. Console.WriteLine($"For {hours} hours the pool overflows with {poolState - volumePool:F2} liters.");
  26. }
  27.  
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement