Advertisement
Guest User

Untitled

a guest
Jun 28th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 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 ConsoleApp2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var xKvMeterLoze = int.Parse(Console.ReadLine());
  14.             var yGrozdeForOneKvMeter = double.Parse(Console.ReadLine());
  15.             var zNujniLitterVino = int.Parse(Console.ReadLine());
  16.             var countWorkers = int.Parse(Console.ReadLine());
  17.  
  18.             var allGrozde = xKvMeterLoze * yGrozdeForOneKvMeter;
  19.             var vino = (0.4 * allGrozde) / 2.5;
  20.  
  21.             if(vino >= zNujniLitterVino)
  22.             {
  23.                 Console.WriteLine($"Good harvest this year! Total wine: {Math.Floor(vino)} liters.");
  24.                 var extraWine = Math.Ceiling(vino - zNujniLitterVino);
  25.                 Console.WriteLine($"{Math.Ceiling(extraWine)} liters left -> {Math.Ceiling(extraWine / countWorkers)} liters per person.");
  26.             }
  27.             else if(vino < zNujniLitterVino)
  28.             {
  29.                 Console.WriteLine($"It will be a tough winter! More {Math.Floor(zNujniLitterVino - vino)} liters wine needed.");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement