Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int x = int.Parse(Console.ReadLine()); // ==\\
- decimal y = decimal.Parse(Console.ReadLine()); // ===> complex names are unnecessary
- int z = int.Parse(Console.ReadLine()); // ==//
- int workers = int.Parse(Console.ReadLine());
- decimal wine = x * 0.4m * y / 2.5m;
- decimal wineleft = Math.Abs(wine - z); // fist calculating remainding wine
- decimal wineworker = wineleft / workers; // then wineworkers
- if (wine >= z) // not (wine > z)
- {
- Console.WriteLine("Good harvest this year! Total wine: {0} liters.",
- Math.Floor(wine)); // not Math.Ceiling()
- Console.WriteLine("{0} liters left -> {1} liters per person.",
- Math.Ceiling(wineleft), Math.Ceiling(wineworker)); // not Math.Floor()
- }
- else // just else - without condition
- {
- Console.WriteLine("It will be a tough winter! More {0} liters wine needed.",
- Math.Floor(wineleft)); // not Math.Round()
- }
- // no need return at the end
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement