Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. end each prompt with newline. ex: for the user input 123, 395, 25, the expected output is: enter a number (<100: enter a number (<100: enter a number (<100: your number < 100 is: 25

Respuesta :

tonb
Here's a solution in plain C:

int num;
do { printf("enter a number (<100)\n"); scanf_s("%d", &num, sizeof(num)); } while (num >= 100);
printf("your number <100 is %d", num);

Note that this solution has flaws. It is unclear what should happen when the user types a negative number or a floating point number. Also it doesn't handle incorrect input (e.g., "aaa") at all.

But you get the idea.