Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Input 100 please! (1) Read integer 100 from the keyboard. The program will keep asking for 100 if the user gives a different number (let's
Input 100 please! (1) Read integer 100 from the keyboard. The program will keep asking for 100 if the user gives a different number (let's assume only integers will be entered for now), e.g, Please enter 100: 99 I'm sorry, you must enter 100: 101 I'm sorry, you must enter 100: 100 Got 100! (2) Assume the user may enter non-integer characters like "abcd". (a) use the return value of scanf function to detect; and (b) call clearKeyboardBuffer( to remove the non-integer characters before reading new input Please enter 100: abcde I'm sorry, you must enter 100: ok I'm sorry, you must enter 100: 100 Got 100! 5 #include 6 7 int main(int argc, char* argv[]) { 8 int input; 9 printf("Please enter 100: "); 11 scanf("%d", &input); 12 13 14 printf("Got %d! ", input); 15 return 0; 10 16 }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started