0

Hello,

I am trying to write a C# program that will calculate the minimum number of coins need from X amount of pence entered by the user in the form of £2, £1 etc. I have come up with this so far (Think its right), but how would i print out the results in "resultNumbersOfEachCoin" so the user can see which coins they need?

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Coin_Calculator
{
class Program
{
static void Main(string[] args)
{
int[] britishCoinValues = new int[] { 1, 2, 5, 10, 20, 50, 100, 200 };
int useramountInPence;
int indexOfCurrentCoinToCheck;
int numberOfThisCoin;
int[] resultNumbersOfEachCoin = new int[8];
Console.WriteLine("Enter the amount in pence");
useramountInPence = Convert.ToInt32(Console.ReadLine());
int remainingAmountToAllocateToCoins = useramountInPence;
for (indexOfCurrentCoinToCheck = 7; indexOfCurrentCoinToCheck >= 0; indexOfCurrentCoinToCheck--)
{
numberOfThisCoin = remainingAmountToAllocateToCoins / britishCoinValues[indexOfCurrentCoinToCheck];
resultNumbersOfEachCoin[indexOfCurrentCoinToCheck] = numberOfThisCoin;
remainingAmountToAllocateToCoins -= (numberOfThisCoin * britishCoinValues[indexOfCurrentCoinToCheck]);
if (remainingAmountToAllocateToCoins == 0) break;
}
}
}
}
```

Any help REALLy appreciated.