Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- decimal budget = decimal.Parse(Console.ReadLine());
- decimal pricePer1KgFlour = decimal.Parse(Console.ReadLine());
- decimal priceForPackOfEggs = pricePer1KgFlour * 0.75m;
- decimal priceFor1lMilk = pricePer1KgFlour * 1.25m * 0.25m;
- decimal priceForCozonac = pricePer1KgFlour + priceFor1lMilk + priceForPackOfEggs;
- int eggs = 0;
- int cozonacs = 1;
- while (budget >= priceForCozonac)
- {
- eggs += 3;
- if (cozonacs % 3 == 0)
- {
- eggs -= cozonacs - 2;
- }
- budget -= priceForCozonac;
- cozonacs++;
- }
- Console.WriteLine($"You made {cozonacs - 1} cozonacs! Now you have {eggs} eggs and {budget:F2}BGN left.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement