Advertisement
Guest User

19. *Тръби в басейн

a guest
Jan 22nd, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp10
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var obem = int.Parse(Console.ReadLine());
  10. var debit1 = int.Parse(Console.ReadLine());
  11. var debit2 = int.Parse(Console.ReadLine());
  12. var hours = double.Parse(Console.ReadLine());
  13.  
  14. var tryba1 = hours * debit1;
  15. var tryba2 = hours * debit2;
  16. var zapylnen = tryba1 + tryba2;
  17. var zapylnenPercent1 = tryba1 / zapylnen * 100;
  18. var zapylnenPercent2 = tryba2 / zapylnen * 100;
  19. var zapylnenPercent = zapylnen / obem * 100;
  20.  
  21. if (obem >= zapylnen)
  22. {
  23. Console.WriteLine($"The pool is {zapylnenPercent.ToString("0")}% full. Pipe 1: {Math.Floor(zapylnenPercent1)}%. Pipe 2: {Math.Floor(zapylnenPercent2)}%.");
  24. }
  25.  
  26. else if (obem < zapylnen)
  27. {
  28. var gornitsa = zapylnen - obem;
  29. Console.WriteLine($"For {hours} hours the pool overflows with {gornitsa.ToString("0.0")} liters.");
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement