Question: create a program that inputs a number n and an operand ( + , - or * ) from a user and prints the result
create a program that inputs a number n and an operand or from a user and prints the result of the operation on numbers from to n
Use three functions:
bool isValidnumint Takes the user input as an argument, and returns true if it is a valid selection. Otherwise it returns false.
bool isValidopchar Takes the user operand input as an argument, and returns true if it is a valid selection. Otherwise it returns false.
int resultint char Takes the number and the operand as arguments. Performs the required operation, and returns the result.
IMPORTANT!
The functions should not print any value. All the values are printed from the mainfunction.
Do not modify the main function. Write the functions such that they work in the code provided.
Sample Output:
Enter a number :
Enter an operand :
The sum of numbers from to is:
Do you want to continue y n: y
Enter a number :
ERROR: Number must be within and
Enter a valid number :
Enter an operand :
ERROR: Operand must be either or
Enter a valid operand :
The product of numbers from to is:
Do you want to continue y n: n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
