void mul()
{
int x,y,sum = 0;
scanf("%d",&x);
scanf("%d",&y);
while (x != 0){
if (x%2 != 0)
sum = sum + y;
x = x/2;
y = 2*y;
}
printf("%d",sum);
}
int main()
{
char c;
printf("Enter two numbers and y to exit");
//mul();
scanf("%c",&c);
while (c != 'y'){
mul();
}
return 0;
}
在运行这个程序时,它不会在给出输入“y”时退出。为什么?