Advertisement
Guest User

Pulbs in the pool

a guest
Oct 8th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 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 Pulbs_in_pool
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var v =int.Parse(Console.ReadLine());
  14. var p1 = int.Parse(Console.ReadLine());
  15. var p2 = int.Parse(Console.ReadLine());
  16. var h = Double.Parse(Console.ReadLine());
  17. var bothPipe = (p1 * h) + (p2 * h);
  18. if (v >= (p1*h) + (p2*h))
  19. {
  20. var vPercent = (p1 * h) + (p2 * h);
  21. var vPercent1 = (vPercent / v) * 100;
  22. var p1Percent = (p1 * h) / bothPipe * 99;
  23. var p2Percent = (p2 * h) / bothPipe * 99;
  24. Console.WriteLine("The pool is {0}% full. Pipe 1: {1:0}%. Pipe 2: {2:0}%.",vPercent1,p1Percent,p2Percent);
  25. }
  26. else
  27. {
  28. var overflow = bothPipe - v;
  29. Console.WriteLine("For {0} hours the pool overflows with {1:0} liters.",h,overflow);
  30. }
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement