Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Easter_Cozonacs
- {
- class Program
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double priceOfFloor = double.Parse(Console.ReadLine());
- double priceForEggs = 0.75 * priceOfFloor;
- double priceForMilk = 1.25 * priceOfFloor;
- double newBudget = budget;
- int numberOfCozonacsForCalculation = 0;
- int numberOfEggs = 0;
- int numberOfCozonacs = 0;
- double priceForOneCozonacs = priceForEggs + priceOfFloor + 0.25 * priceForMilk;
- while (priceForOneCozonacs < newBudget)
- {
- newBudget -= priceForOneCozonacs;
- numberOfCozonacsForCalculation++;
- numberOfEggs += 3;
- numberOfCozonacs++;
- if (numberOfCozonacsForCalculation == 3)
- {
- numberOfEggs -= numberOfCozonacs - 2;
- numberOfCozonacsForCalculation = 0;
- }
- }
- if (priceForOneCozonacs > newBudget)
- {
- Console.WriteLine($"You made {numberOfCozonacs} cozonacs! Now you have {numberOfEggs} eggs and {newBudget:f2}BGN left.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement