【发布时间】:2024-12-06 16:10:02
【问题描述】:
#include <stdio.h>
int main (void)
{
int cash,num10s,change;
printf("please enter the amount you wish to withdraw\n");
scanf("%d", &cash);
num10s = (cash / 10);
change = (cash % 10);
printf("%d",change);
while (change != 0);
{
printf("please enter a value in 10s\n");
scanf("%d",&cash);
change = (cash % 10);
}
printf("sucess\n");
return (0);
}
即使更改值为 0,while 循环仍会运行一次迭代。为什么会这样,我该如何缓解这个问题
【问题讨论】:
标签: c loops while-loop