Advertisement
Spocoman

Cake Tycoon

Oct 11th, 2023 (edited)
936
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CakeTycoon
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int plannedCakes = int.Parse(Console.ReadLine());
  10.             double cakeFlour = double.Parse(Console.ReadLine());
  11.             int flourAvailable = int.Parse(Console.ReadLine());
  12.             int truffleCount = int.Parse(Console.ReadLine());
  13.             int trufflePrice = int.Parse(Console.ReadLine());
  14.  
  15.             int cakes = (int)(flourAvailable / cakeFlour);
  16.  
  17.             if (cakes >= plannedCakes)
  18.             {
  19.                 double cakePrice = (double)truffleCount * trufflePrice / plannedCakes * 1.25;
  20.                 Console.WriteLine($"All products available, price of a cake: {cakePrice:f2}");
  21.             }
  22.             else
  23.             {
  24.                 double flourNeeded = plannedCakes * cakeFlour - flourAvailable;
  25.                 Console.WriteLine($"Can make only {cakes} cakes, need {flourNeeded:f2} kg more flour");
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement