Advertisement
Jann24

Zad4

Nov 20th, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1.             int x = int.Parse(Console.ReadLine());
  2.             double y = double.Parse(Console.ReadLine());
  3.             int z = int.Parse(Console.ReadLine());
  4.             int n = int.Parse(Console.ReadLine());
  5.  
  6.  
  7.             double totalWine = 0.4 * x * y / 2.5;
  8.             if(totalWine >= z)
  9.             {
  10.                 Console.WriteLine($"Good harvest this year! Total wine: {(int)Math.Floor(totalWine)} liters.");
  11.                 int leftOutWine = (int)Math.Ceiling(totalWine - z);
  12.                 int winePerWorker = (int)Math.Ceiling((double)leftOutWine / n);
  13.                 Console.WriteLine($"{leftOutWine} liters left -> {winePerWorker} liters per person.");
  14.             }
  15.             else
  16.             {
  17.                 Console.WriteLine($"It will be a tough winter! More {(int)Math.Floor(z - totalWine)} liters wine needed.");
  18.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement