Advertisement
spasnikolov131

Untitled

May 7th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Conditional_Statements___More_Exercises
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double V = double.Parse(Console.ReadLine());
  10. double P1 = double.Parse(Console.ReadLine());
  11. double P2 = double.Parse(Console.ReadLine());
  12. double H = double.Parse(Console.ReadLine());
  13.  
  14. double totalV = (H * P1) + (H * P2);
  15.  
  16. if (totalV <= V)
  17. {
  18. double P1Debit = P1 * H / totalV * 100; //P1debit - totalH
  19. double P2Debit = P2 * H / totalV * 100;
  20. Console.WriteLine($"The pool is {totalV * 0.1:F2}% full. Pipe 1: {P1Debit:F2}%." +
  21. $"Pipe 2: {P2Debit:F2}%.");
  22. }
  23. else
  24. {
  25. Console.WriteLine($"For {H} hours the pool overflows with {(totalV - V):F2} liters.");
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement