EmoRz

Pipes

Jun 27th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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 Pipes
  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.  
  18. var p1h =p1*h;
  19. var p2h = p2 * h;
  20. var pipeResult = p1h + p2h;
  21. var percentP1 = Math.Truncate((p1h / pipeResult)*100);
  22. var percentP2 = Math.Truncate((p2h / pipeResult)*100);
  23.  
  24. var vResult = Math.Truncate((pipeResult / v)*100);
  25. if(pipeResult>v)
  26. {
  27. Console.WriteLine("For {0:} hours the pool overflows with {1:} liters.",h,pipeResult-v);
  28. }
  29. if(pipeResult<v)
  30. {
  31. Console.WriteLine("The pool is {0:.}% full. Pipe 1: {1:.}%. Pipe 2: {2:.}%.",vResult,percentP1,percentP2);
  32. }
  33.  
  34.  
  35.  
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment