Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace EasterCozonacs
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double price1kgFlour = double.Parse(Console.ReadLine());
- double price1packEggs = 0.75 * price1kgFlour;
- double price1lMilk= price1kgFlour + (0.25 * price1kgFlour);
- double priceMilkForOneCozunac = price1lMilk / 4;
- double totalPriceForOneCozunac = price1kgFlour + price1packEggs + priceMilkForOneCozunac;
- int countCozunacs = (int) Math.Floor(budget / totalPriceForOneCozunac);
- int countColoredEggs = 0;
- double moneyLeft = budget - (totalPriceForOneCozunac * countCozunacs);
- for (int i = 1; i <=countCozunacs; i++)
- {
- countColoredEggs += 3;
- if (i % 3 == 0)
- {
- countColoredEggs -= i - 2;
- }
- }
- Console.WriteLine($"You made {countCozunacs} cozonacs! Now you have {countColoredEggs} eggs and {moneyLeft:F2}BGN left.");
- }
- }
- }
Add Comment
Please, Sign In to add comment