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 ConsoleApplication9
- {
- using System.Numerics;
- class Program
- {
- static void Main(string[] args)
- {
- //Console.WriteLine("number cakes n: ");
- decimal cakesAmount = decimal.Parse(Console.ReadLine());
- //Console.WriteLine("necflour c: ");
- decimal kilograms = decimal.Parse(Console.ReadLine());
- //Console.WriteLine("all flour f: ");
- decimal availableFlour = decimal.Parse(Console.ReadLine());
- //Console.WriteLine("all truffles t: ");
- long truffels = long.Parse(Console.ReadLine());
- //Console.WriteLine("price of truffles p: ");
- decimal priceOfTruffel = decimal.Parse(Console.ReadLine());
- decimal flourneed = cakesAmount * kilograms; //123*1.2=147.6
- decimal price = 0;
- if (availableFlour >= flourneed) //150>147.6 >> true
- {
- price = (truffels/cakesAmount);
- price = price*priceOfTruffel;
- price = price*1.25m; //(15/123)*2000*(1.25) = 304.878
- Console.WriteLine("All products available, price of a cake: {0:F2}", price);
- }
- else
- {
- decimal posscake = Convert.ToInt32(Math.Truncate(availableFlour / kilograms));
- decimal neededflour = flourneed - availableFlour;
- Console.WriteLine("Can make only {0} cakes, need {1:F2} kg more flour", posscake, neededflour);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement