Guest User

Untitled

a guest
Sep 11th, 2016
123
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _02.PoolPipes
  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 pipe1 = H * P1;
  18. var pipe2 = H * P2;
  19. var total = pipe1 + pipe2;
  20. if (total <= V)
  21. {
  22. var percentFull = Math.Floor((total / V) * 100);
  23. var pipe1Percent = Math.Floor((pipe1 / total) * 100);
  24. var pipe2Percent = Math.Floor((pipe2 / total) * 100);
  25. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", percentFull, pipe1Percent, pipe2Percent);
  26. }
  27. else
  28. {
  29. var overflow = total - V;
  30. Console.WriteLine("For {0} hours the pool overflows with {1} liters.",H ,overflow);
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment