public static void Main()
string[] coffees = { "Latte", "Americano", "Espresso", "Capuccino" };
for (int i = 1; i < coffees.Length+1; i++)
Console.WriteLine(i + "." + coffees[i-1] + " : " + i * 100 + " DRAM");
Console.Write("\n" + "Insert your money: ");
int insertedMoney = Convert.ToInt32(Console.ReadLine());
if (insertedMoney%50 !=0)
Console.WriteLine("Wrong input, try again! \n ");
bool notEnoughMoney = true;
Console.Write("Choose the number of the coffee: ");
int choice = Convert.ToInt32(Console.ReadLine());
if (choice > 0 && choice <= 4)
coffeePrice = choice * 100;
Console.WriteLine("Wrong input, try again");
if (insertedMoney == coffeePrice)
else if (insertedMoney < coffeePrice)
int toBeAdded = coffeePrice - insertedMoney;
Console.WriteLine("Please add " + toBeAdded + " DRAM");
int moreinsert = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Wrong input, try again!");
insertedMoney += moreinsert;
else if (insertedMoney > coffeePrice)
int c = insertedMoney - coffeePrice;
Console.WriteLine("Your change of " + c + " DRAM will be yielded");
Console.Write("Choose the amount of sugar in your coffee: ");
int sugarAmount = Convert.ToInt32(Console.ReadLine());
int change = insertedMoney - coffeePrice;
ChangeDenomination(change);
Console.WriteLine("\n" + "********************************" + "\n");
static void AddSugar(int amount)
for (int i = 0; i < amount; i++)
Console.WriteLine("a teaspoon of sugar added");
static void ChangeDenomination(int change)
int[] changes = { 500, 200, 100,50 };
if (change >= changes[c])
for (int i = 0; i < change/changes[c]; i++)
Console.WriteLine(changes[c]);