Write a program which will hastwo functions, the main function and the inputfunc
ID: 3617219 • Letter: W
Question
Write a program which will hastwo functions, the main function and the inputfunction.
The input function asks the userto enter an integer from 10 to 20, inclusive.
In the inputfunction:
1) If the user enters a numberthat is out of the required range, the number is NOT returned tothe main function; instead it loops to ask the user to enter acorrect number.
2) If the user enters a numberin the required range, the number is returned to the mainfunction.
3) If the user enters End OfFile, the input function returns a negative one to the mainfunction.
When the main function receives-1 from the input function, it prints a completion message and theprogram ends.
When the main function receivesany other number, the main function prints it, and calls the inputfunction again.
The input function does NOTprint anything.
Explanation / Answer
I am not sure you needed in what programming language, so I justwrote in C++ language. The do...while function is a loop functionthat will at least execute once before checking whether thecondition is fulfilled. In this case, the condition is the integeris >= 10 andRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.