OK I Have this
Code:
int get_data(int money)
{
int count2;
int new_cash;
int error;
for (count2 = 0; count2 < 100; count2 += 1){
int temp_money = money % 10;
if(temp_money == 0){
break;
} else if((temp_money % 10) != 0)
printf("\n\nThis machine dispenses ONLY $50, $20, $10...\n\n");
printf("Please enter again");
scanf("%d", &money);
}
new_cash = money;
return(new_cash);
}
Whenever I go through it the first time it doesn't work. But whenever it asks to enter the number again and I put in the same number it works. Does anybody see what I am doing wrong?
As for everyones early suggestions, I am required to make it so that if it isn't able to make change with numbers divisble by 10 then it has to prompt the user to enter it again.
thanks