mattnguyen

Untitled

Mar 16th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Practice
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double x = double.Parse(Console.ReadLine());
  10. double y = double.Parse(Console.ReadLine());
  11. double z = double.Parse(Console.ReadLine());
  12. int workers = int.Parse(Console.ReadLine());
  13.  
  14. double totalGrapes = x * y;
  15. double wine = 0.4 * totalGrapes / 2.5;
  16.  
  17. if (wine >= z)
  18. {
  19. double diff = wine - z;
  20. double litresPerPerson = diff / workers;
  21.  
  22. Console.WriteLine($"Good harvest this year! Total wine: {wine} liters.");
  23. Console.WriteLine($"{diff} liters left -> {litresPerPerson} liters per person.");
  24. }
  25. else
  26. {
  27. double diff = Math.Round(z - wine);
  28. Console.WriteLine($"It will be a tough winter! More {diff} liters wine needed.");
  29. }
  30. }
  31. }
  32. }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment