#include <stdio.h> #include <stdlib.h> int main() { 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 %ld.\n",sum); return 0; }程序运行如下:
问题:
在while循环条件处:while(status==1),但status=scanf("%ld",&num),将出入的num长整型赋予status,while(status==1)是怎样处理测试循环条件的?请大神解答。