Guest User

Untitled

a guest
Sep 25th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 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 _18.Pool_Pipes_Past_Paper_Exam
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var V = double.Parse(Console.ReadLine());
  14. var P1 = double.Parse(Console.ReadLine());
  15. var P2 = double.Parse(Console.ReadLine());
  16. var H = double.Parse(Console.ReadLine());
  17. var pipeone = (P1 * H);
  18. var pipetwo = (P2 * H);
  19. var sum = pipeone + pipetwo;
  20. var persentofpullfull = Math.Truncate((sum / V) * 100);
  21. var pipeonepersent = Math.Truncate((pipeone / sum) * 100);
  22. var pipetwopersent = Math.Truncate((pipetwo / sum) * 100);
  23. var overflow = sum - V;
  24. if (sum<=V)
  25. {
  26. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",persentofpullfull,pipeonepersent,pipetwopersent);
  27. }
  28. else if (sum>=V)
  29. {
  30. Console.WriteLine("For {0} hours the pool overflows with {1} liters.",H,overflow);
  31. }
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment