Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 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 ConsoleApp4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int volumeInLitres = int.Parse(Console.ReadLine());
  14. int pipe1 = int.Parse(Console.ReadLine());
  15. int pipe2 = int.Parse(Console.ReadLine());
  16. double hours = double.Parse(Console.ReadLine());
  17.  
  18. double litresForHours = (pipe1 + pipe2) * hours;
  19. double percentLitres = litresForHours / volumeInLitres * 100;
  20. double percentPipe1 = pipe1 * hours / litresForHours * 100;
  21. double percentPipe2 = pipe2 * hours / litresForHours * 100;
  22.  
  23. if (volumeInLitres >= litresForHours)
  24. {
  25. Console.WriteLine($"The pool is {percentLitres:F2}% full. Pipe 1: {percentPipe1:F2}%. Pipe 2: {percentPipe2:F2}%.");
  26. }
  27. else
  28. {
  29. Console.WriteLine($"For {hours:f2} hours the pool overflows with {litresForHours - volumeInLitres:F2} liters.");
  30.  
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement