Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _1.Sweet_Dessert
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal cash = decimal.Parse(Console.ReadLine());
- int guests = int.Parse(Console.ReadLine());
- decimal bananasPrice = decimal.Parse(Console.ReadLine());
- decimal eggsPrice = decimal.Parse(Console.ReadLine());
- decimal berriesPrice = decimal.Parse(Console.ReadLine());
- int sets = 0;
- if (guests > 0)
- {
- sets = 1;
- while (guests > 6)
- {
- sets++;
- guests = guests - 6;
- }
- }
- decimal priceOfSet = 2 * bananasPrice + 4 * eggsPrice + 0.2m * berriesPrice;
- decimal totalPrice = sets * priceOfSet;
- if (cash >= totalPrice)
- {
- Console.WriteLine("Ivancho has enough money - it would cost {0:f2}lv.", totalPrice);
- }
- else
- {
- Console.WriteLine("Ivancho will have to withdraw money - he will need {0:f2}lv more.", totalPrice - cash);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement