Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _01_CakeTycoon
- {
- class cakeTycoon
- {
- static void Main(string[] args)
- {
- // The number n – amount of cakes Ivancho wants.
- //• The number c – kilograms of flour needed to make one cake.
- //• The number f – kilograms of flour available.
- //• The number t – amount of truffles available.
- //• The number p – price of one truffle.
- ulong n = ulong.Parse(Console.ReadLine());
- decimal c = decimal.Parse(Console.ReadLine());
- uint f = uint.Parse(Console.ReadLine());
- uint t = uint.Parse(Console.ReadLine());
- uint p = uint.Parse(Console.ReadLine());
- var cakesCanBeMade = Math.Truncate( f / c);
- var flouirForWishNumberOfCakes = n * c;
- var diffFlour = flouirForWishNumberOfCakes - f;
- decimal priceCake = (t * p )/ n;
- decimal priceTotal = priceCake*(decimal)1.25;
- if (cakesCanBeMade<n)
- {
- Console.WriteLine("Can make only {0} cakes, need {1:f2} kg more flour", cakesCanBeMade, diffFlour);
- }
- else
- {
- Console.WriteLine("All products available, price of a cake: {0}",priceTotal);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement