- #1
dudforreal
- 116
- 0
I don't understand why this would work, shouldn't it be "while(x)" because we don't want to repeat the loop?
Code:
int main(void)
{
int x=0;
do {
printf("Enter an amount:\n");
scanf("%lf", &amount);
if (amount < 100)
x=1;
else
printf("Invalid");
}while(!x);
return 0;
}