Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CakeTycoon
- {
- class Program
- {
- static void Main(string[] args)
- {
- int plannedCakes = int.Parse(Console.ReadLine());
- double cakeFlour = double.Parse(Console.ReadLine());
- int flourAvailable = int.Parse(Console.ReadLine());
- int truffleCount = int.Parse(Console.ReadLine());
- int trufflePrice = int.Parse(Console.ReadLine());
- int cakes = (int)(flourAvailable / cakeFlour);
- if (cakes >= plannedCakes)
- {
- double cakePrice = (double)truffleCount * trufflePrice / plannedCakes * 1.25;
- Console.WriteLine($"All products available, price of a cake: {cakePrice:f2}");
- }
- else
- {
- double flourNeeded = plannedCakes * cakeFlour - flourAvailable;
- Console.WriteLine($"Can make only {cakes} cakes, need {flourNeeded:f2} kg more flour");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement