plamen27

Harvest fixed

Jul 27th, 2016
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. double x = double.Parse(Console.ReadLine());
  8. double y = double.Parse(Console.ReadLine());
  9. double z = double.Parse(Console.ReadLine());
  10. double rab = double.Parse(Console.ReadLine());
  11. double grozde = x * y;
  12. double total = 0.4 * grozde / 2.5;
  13. if (total >= z)
  14. {
  15. double litr = Math.Ceiling(total - z);
  16. double litrPer = Math.Ceiling(litr / rab);
  17. Console.WriteLine("Good harvest this year! Total wine: {0} liters.", Math.Floor(total));
  18. Console.WriteLine("{0} liters left -> {1} liters per person.", litr, litrPer);
  19. }
  20. else
  21. {
  22. Console.WriteLine("It will be a tough winter! More {0} liters wine needed.", Math.Floor(z - total));
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment