Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 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 PoolPippes
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var volume = ushort.Parse(Console.ReadLine());
  14. var p1 = ushort.Parse(Console.ReadLine());
  15. var p2 = ushort.Parse(Console.ReadLine());
  16. var hours = float.Parse(Console.ReadLine());
  17.  
  18.  
  19. var totalP1 = p1 * hours;
  20. var totalp2 = p2 * hours;
  21. var totalPipe = totalP1 + totalp2;
  22. var procentP1 = Math.Floor((totalP1 * 100 / totalPipe));
  23. var procentp2 = Math.Floor((totalp2 * 100 / totalPipe));
  24. var procentTotal = Math.Floor(totalPipe * 100 / volume);
  25.  
  26. if (totalPipe <= volume)
  27.  
  28. {
  29. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",
  30. procentTotal,
  31. procentP1,
  32. procentp2);
  33. }
  34. else
  35. {
  36. var overflows = totalPipe - volume;
  37. Console.WriteLine("For {0} hours the pool overflows with {1} liters.",
  38. hours,
  39. overflows);
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement