#include <stdio.h> int main(void) { long num; printf("please input an positive num: "); while(1) { while(scanf("%ld", &num) != 1) { printf("please input an num. try again.\n"); while(getchar() != '\n') continue; } if(num <= 0) { printf("please input an positive.\n"); continue; } if(num > 0) { printf("num- num: %d.\n", num); } int trigger; printf("please choose to exit(100): "); scanf("%d", &trigger); printf("trigger: %d.\n", trigger); if(trigger == 100) break; while(getchar() != '\n') continue; printf("please input an positive num: "); } return 0; }