while循环的问题 请求解答
#include<stdio.h>int main(void)
{
long num;
long sum=0L;
int status ;
printf("Please enter an integer to bo summed");
printf("q to quit):");
status=scanf("%ld",&num);
while(status==1)
{
sum=sum+sum;
printf("Please enter next integer(q to quit)");
status=scanf("%ld",&sum);
}
printf("Those integers sum to %ld.\n",sum);
return 0;
}
status=scanf("%ld",&sum);
输入如 10 . status 的值就等于10.
while(status==1)
10不等价于1啊。怎么会继续循环呢?
%ld 输入10 ,结果是1吗?