I was trying to create a program that will display the imputed amount and the number of $10 and $1 notes that an ATM can dispense but it will not display correct amount of $1 notes.
int amount = int.Parse(txtAmount.Text);
int tenNotes=0, oneNotes=0;
CalculateNotes(amount, ref tenNotes, ref oneNotes);
private void CalculateNotes( int amount, ref int tenNotes, ref int OneNotes)
{
tenNotes = amount /10;
OneNotes = amount - amount % 10;
rtbDisplay.AppendText("Ammount is " + amount + "Ten notes is" + tenNotes + "One notes is" + OneNotes);
}
This is the output I have tried different method of calculation for $1 notes but it does not work. Am I supposed to use out instead of ref or is there an error in my calculation? Thank you for any help.