Advertisement
YavorGrancharov

Sweet_Dessert(80%)

Aug 31st, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Sweet_Dessert
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var cash = decimal.Parse(Console.ReadLine());
  10.             var guests = decimal.Parse(Console.ReadLine());
  11.             var bannanaPrice = decimal.Parse(Console.ReadLine());
  12.             var eggsPrice = decimal.Parse(Console.ReadLine());
  13.             var berrriesPrice = decimal.Parse(Console.ReadLine());
  14.  
  15.             var portions = Math.Ceiling(guests / 6);
  16.  
  17.             var result = portions * (bannanaPrice * 2) + portions * (eggsPrice * 4) + portions * (berrriesPrice * 0.2m);
  18.  
  19.             if (cash > result)
  20.             {
  21.                 Console.WriteLine("Ivancho has enough money - it would cost {0:F2}lv.", result);
  22.             }
  23.             else
  24.             {
  25.                 Console.WriteLine("Ivancho will have to withdraw money - he will need {0:F2}lv more.", result - cash);
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement