Advertisement
Guest User

Untitled

a guest
Sep 5th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 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 _02.Harvest
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var x = int.Parse(Console.ReadLine());
  14. var y = double.Parse(Console.ReadLine());
  15. var z = int.Parse(Console.ReadLine());
  16. var workers = int.Parse(Console.ReadLine());
  17. var harvest = x * y * 0.4;
  18. var wine = harvest / 2.5;
  19. if (wine < z)
  20. {
  21. var wineNeeded = Math.Floor(z - wine);
  22. Console.WriteLine("It will be a tough winter! More {0} liters wine needed.",wineNeeded);
  23. }
  24. else
  25. {
  26. var totalWine = Math.Floor(wine);
  27. var wineLeft = Math.Ceiling(wine - z);
  28. var winePerWorker = Math.Ceiling(wineLeft/workers);
  29. Console.WriteLine("Good harvest this year! Total wine: {0} liters.",totalWine);
  30. Console.WriteLine("{0} liters left -> {1} liters per person.",wineLeft ,winePerWorker);
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement