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;
- using System.Numerics;
- class cakeTycoon
- {
- static void Main(string[] args)
- {
- decimal n = decimal.Parse(Console.ReadLine());
- decimal c = decimal.Parse(Console.ReadLine());
- decimal f = decimal.Parse(Console.ReadLine());
- decimal t = decimal.Parse(Console.ReadLine());
- decimal p = decimal.Parse(Console.ReadLine());
- decimal kilograms = f / c;
- if (kilograms >= n)
- {
- t *= p;
- decimal totalPrice = (t / n) * 1.25M;
- Console.WriteLine("All products available, price of a cake: {0:f2}", totalPrice);
- }
- else
- {
- decimal flourRequired = c * n;
- decimal kilogramNeeded = flourRequired - f;
- Console.WriteLine("Can make only {0} cakes, need {1:f2} kg more flour", Math.Floor(kilograms), kilogramNeeded);
- }
- {
- }
- //decimal totalPrice = (t / n) * (kilograms / 100M);
- //Console.WriteLine("{0:f2}", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement