Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Shopping
- {
- class Program
- {
- static void Main()
- {
- decimal budget = decimal.Parse(Console.ReadLine());
- int numberOfChocos = int.Parse(Console.ReadLine());
- double amountOfMilk = double.Parse(Console.ReadLine());
- decimal priceMilk = 2.7m;
- decimal priceChoco = 0.65m;
- decimal priceMandarin = 0.2m;
- int numberOfMandarin = (int)(numberOfChocos * (1 - 0.35));
- decimal totalCost = numberOfChocos * priceChoco + numberOfMandarin * priceMandarin + (decimal)amountOfMilk * priceMilk;
- decimal diff = Math.Abs(totalCost - budget);
- if (budget >= totalCost)
- {
- Console.WriteLine($"You got this, {diff:F2} money left!");
- }
- else
- {
- Console.WriteLine($"Not enough money, you need {diff:F2} more!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement