rado84

PipesInAPool-Solution

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