cvet40

Untitled

May 30th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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 p06.Bonus_Score
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. int poolVolume = int.Parse(Console.ReadLine());
  15. int firstPipeDebit = int.Parse(Console.ReadLine());
  16. int secondPipeDebit = int.Parse(Console.ReadLine());
  17. double hours = double.Parse(Console.ReadLine());
  18.  
  19. double bothPipes = (firstPipeDebit + secondPipeDebit) * hours;
  20.  
  21. if (bothPipes > poolVolume)
  22. {
  23. Console.WriteLine($"For {hours} hours the pool overflows with {(bothPipes - poolVolume):F1} liters.");
  24. }
  25. else
  26. {
  27. double firstPipePercentige = Math.Floor((firstPipeDebit * hours) * 100 / bothPipes);
  28. double secondPipePercentige = Math.Floor((secondPipeDebit * hours) * 100 / bothPipes);
  29. double bothPipesPercentige = Math.Floor((bothPipes * 100) / poolVolume);
  30. Console.WriteLine($"The pool is {bothPipesPercentige}% full. Pipe 1: {firstPipePercentige}%. Pipe 2: {secondPipePercentige}%.");
  31.  
  32. }
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment