Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Harvest
- {
- class Program
- {
- static void Main()
- {
- // Harvest - from Exam 17/07/2016 of Programming Basics
- int x = int.Parse(Console.ReadLine()); //total cb.m.
- double y = double.Parse(Console.ReadLine()); //grape per 1 cb.m.
- int z = int.Parse(Console.ReadLine()); //needed wine
- int n = int.Parse(Console.ReadLine()); //workers
- var forWine = 0.4 * x;
- var grape = forWine * y;
- var wine = grape / 2.5;
- if (wine < z)
- {
- var lack = Math.Floor(z - wine);
- Console.WriteLine($"It will be a tough winter! More {lack} liters wine needed.");
- }
- else if (wine >= z)
- {
- var rest = Math.Ceiling(wine - z);
- var winePerPerson = Math.Ceiling(rest / n);
- Console.WriteLine($"Good harvest this year! Total wine: {wine} liters.");
- Console.WriteLine($"{rest} liters left -> {winePerPerson} liters per person.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement