Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- string name = Console.ReadLine();
- double money = double.Parse(Console.ReadLine());
- int bottles = int.Parse(Console.ReadLine());
- int chips = int.Parse(Console.ReadLine());
- double total = bottles * 1.2 + Math.Ceiling((bottles * 1.20) * 0.45 * chips);
- if(money >= total)
- {
- Console.WriteLine("{0} bought a snack and has {1:F2} leva left.", name, money - total);
- }
- else
- {
- Console.WriteLine("{0} needs {1} more leva!", name, total - money);
- }
- }
- }
Add Comment
Please, Sign In to add comment