#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. "); while(getchar() != ' ') continue; } if(num <= 0) { printf("please input an positive. "); continue; } if(num > 0) { printf("num- num: %d. ", num); } int trigger; printf("please choose to exit(100): "); scanf("%d", &trigger); printf("trigger: %d. ", trigger); if(trigger == 100) break; while(getchar() != ' ') continue; printf("please input an positive num: "); } return 0; }