Advertisement
Guest User

Untitled

a guest
Sep 17th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace ConsoleApplication16
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10.  
  11. var v = int.Parse(Console.ReadLine());
  12. var p1 = int.Parse(Console.ReadLine());
  13. var p2 = int.Parse(Console.ReadLine());
  14. var h = double.Parse(Console.ReadLine());
  15. var litersOP1 = p1 * h;
  16. var litersOP2 = p2 * h;
  17.  
  18. var allLiters = litersOP1 + litersOP2;
  19.  
  20. var percentAll = (allLiters / v) * 100;
  21. var percent1 = (litersOP1 / allLiters) * 100;
  22. var percent2 = (litersOP2 / allLiters) * 100;
  23.  
  24. if (v > allLiters)
  25. {
  26. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",(int)percentAll,(int)percent1,(int)percent2);
  27. }
  28. else
  29. {
  30. Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, Math.Abs(allLiters - v));
  31. }
  32.  
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement