Stradjazz

Pool Pipes

Sep 15th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 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 PoolPipes
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int volume = int.Parse(Console.ReadLine());
  14. int pipe1 = int.Parse(Console.ReadLine());
  15. int pipe2 = int.Parse(Console.ReadLine());
  16. double hours = double.Parse(Console.ReadLine());
  17.  
  18. var pipeFlow1 = pipe1 * hours;
  19. var pipeFlow2 = pipe2 * hours;
  20. var water = Math.Floor(pipeFlow1 + pipeFlow2);
  21. var poolFull = water * 100 / volume;
  22. var partPipe1 = pipeFlow1 * 100 / water;
  23. var partPipe2 = pipeFlow2 * 100 / water;
  24. var overflow = Math.Floor(water - volume);
  25.  
  26. if (overflow > 0)
  27. {
  28. Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, overflow);
  29. }
  30. else
  31. {
  32. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", Math.Floor(poolFull), Math.Floor(partPipe1), Math.Floor(partPipe2));
  33. }
  34.  
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment