Advertisement
AlexJC

Тръби в басейн

Aug 27th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace pool_pipe
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int V = int.Parse(Console.ReadLine());
  14. int P1 = int.Parse(Console.ReadLine());
  15. int P2 = int.Parse(Console.ReadLine());
  16. double H = double.Parse(Console.ReadLine());
  17.  
  18. var liter = P1 * H + P2 * H;
  19.  
  20.  
  21. if (liter <= V)
  22.  
  23. {
  24. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", Math.Truncate(100 * liter / V), Math.Truncate(100 * P1 * H / liter), Math.Truncate(100 * P2 * H / liter));
  25. }
  26.  
  27. else
  28. {
  29. Console.WriteLine("For {0} hours the pool overflows with {1} liters.", H, (liter - V));
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement