Question: Example 1: // this function receives a character corresponding to the answer entered by the user in main() and makes sure it is // either
Example 1: // this function receives a character corresponding to the answer entered by the user in main() and makes sure it is // either 'y' or 'n'. If the answer is incorrect, the functions keeps asking for the right answer until it is provided and // then returns it to main() checkanswer( ) { } int main( ) { // declare variable(s) to be used // ask the user if he would you like to continue // prompt the user to enter the answer // get the answer from the keyboard and store it in corresponding variable // determine which answer was entered by the user and // display "Yes" or "No" according to the answer provided by the user // must call the function to ensure the correct answer (y or n) is entered } ? SAMPLE OUTPUT:
Example 2: // this function receives the lower and upper boundaries of a range of whole numbers and returns the additions of // the numbers that are divisible by 7 and the addition of the other numbers additions ( ) { } int main( ) { // declare variable(s) // prompt the user to enter the range's lower and upper boundaries // get the values and store them in variables // call the function to get the additions and display them }? SAMPLE OUTPUT:
? SECOND SAMPLE OUTPUT OF SECOND PROGRAM:
? The output must be exactly the same, complete code for 2 programs please and thank you!!
Would you like to continue? Please enter y or n as an answer: h Please enter y or n as an answer: h Please enter y or n as an answer: h Please enter y or n as an answer: y Yes Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
