Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02.BeerAndChips
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fanName = Console.ReadLine();
- double budget = double.Parse(Console.ReadLine());
- int bottleBeer = int.Parse(Console.ReadLine());
- int chipsPacks = int.Parse(Console.ReadLine());
- double chipsPrice = ((bottleBeer * 1.2) * 0.45) * chipsPacks;
- chipsPrice = Math.Ceiling(chipsPrice);
- double totalSum = bottleBeer * 1.2 + chipsPrice;
- if (budget >= totalSum)
- {
- Console.WriteLine($"{fanName} bought a snack and has {(budget - totalSum):F2} leva left.");
- }
- else
- {
- Console.WriteLine($"{fanName} needs {(totalSum - budget):F2} more leva!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement