Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double priceFlour = double.Parse(Console.ReadLine());
- double priceEggs = priceFlour * 0.75;
- double priceMilk = priceFlour * 1.25;
- double eggBreadPrice = priceFlour + priceEggs + (priceMilk / 4);
- int count = 0;
- int colouredEggs = 0;
- while (budget > eggBreadPrice)
- {
- if (budget < eggBreadPrice)
- {
- break;
- }
- budget -= eggBreadPrice;
- count++;
- colouredEggs += 3;
- if (count % 3 == 0)
- {
- colouredEggs -= count - 2;
- }
- }
- Console.WriteLine($"You made {count} cozonacs! Now you have {colouredEggs} eggs and {budget:F2}BGN left.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement