Guest User

Untitled

a guest
Jun 24th, 2016
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1.  
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace ConsoleApplication5
  10. {
  11. class Program
  12. {
  13. static void Main(string[] args)
  14. {
  15. var v = int.Parse(Console.ReadLine());//1000
  16. var p1 = int.Parse(Console.ReadLine());//100
  17. var p2 = int.Parse(Console.ReadLine());//120
  18. var h = double.Parse(Console.ReadLine());//3
  19. var littresOfp1 = p1 * h;//300
  20. var littresOfp2 = p2 * h;//360
  21.  
  22. var allTheLittres = littresOfp1 + littresOfp2;//660
  23. var percentOffullnes = Math.Floor(allTheLittres * 100 / v);//66%
  24.  
  25. var percentOfP1 = Math.Floor(littresOfp1 * 100 / allTheLittres);//45%
  26. var percentOfP2 = Math.Floor(littresOfp2 * 100 / allTheLittres);//54%
  27.  
  28. if (v >= allTheLittres)
  29. {
  30. Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", percentOffullnes, percentOfP1, percentOfP2);
  31. }
  32. else
  33. {
  34. Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, allTheLittres - v);
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment