为什么没有执行最后的求和,程序就退出了
#include<stdio.h>int main(void)
{
long num;
long sum=0L;
int status;
printf("please enter an integer to be summed ");
printf("(q to quit): ");
status=scanf("%ld",&num);
while (status == 1)
{
sum= sum+num;
printf("please enter next integer (q to quit): ");
status=scanf("%ld",&num);
}
printf("Those integers sum to %d.\n", sum);
return 0;
}