Functions & Loops : Case Studies
write a C++ PROGRAM for following
1. Prompt the user to input two positive integers. Variables: firstNum and secondNum (firstNum must be less than secondNum) (use while loop); create a user-defined function called validateUserInput() to validate the user's input. Use Call-by-Value. validateUserInput() is a value returning function.
2. Output all odd numbers between firstNum and secondNum. (use while loop); create a user-defined function called oddNumbers(). Use Call-by-Value. oddNumbers() is a void function.
3. Output the sum of all even numbers between firstNum and secondNum. (use while loop); create a user-defined function called sumEvenNumbers(). Use Call-by-Value. Declare a variable called sumEven in the main() for the sumEvenNumbers(). sumEvenNumbers() is a value returning function. Use sumEven to hold a returned value.
4. Output the numbers and their squares between 1 and 10. (use while loop): create a user-defined function called displaySquareNumbers(). Call-by-Value. displaySquareNumbers() is a void function.
5. Output the sum of the square of the odd numbers between firstNum and secondNum. (use while loop); create a user-defined function called sumSqureOddNumbers(). Use Call-by-Value. Declare a variable called sumSquareOdd in the main(), for the sumSqureOddNumbers(). sumSqureOddNumbers() is a value returning function. Use sumSquareOdd to hold a returned value.
Answers
Answered by
0
Answer:
Mark as brainliest u will get 50 free points
Similar questions