Question: Questions #2: Number Generator Program (6 pts). In C++, we can use rand() function (More details) to generate random numbers. In the question, we will
Questions #2: Number Generator Program (6 pts). In C++, we can use rand() function (More details) to generate random numbers. In the question, we will generate a 3-digit random number between 100 -- 999 and complete number calculation following the requirements: 1. Display a welcome message. 2. Display the randomly generated even/odd number. 3. Calculate the sum of the 3 digits in the number. For example, the addition of 3 digits in the number 345 is 3+4+5 - 12 4. Calculate the subtraction of the 3 digits in the number. For example, the subtraction of 3 digits in the number 345 is 3-4-5=-6 S. Calculate the multiplication of the 3 digits in the number. For example, the multiplication of 3 digits in the number 345 is 3*4*5=60 6. Calculate the reminder of the number divided by the sum of its 3 digits. For example, if the number is 345, then the reminder is 345%(3+4+5) = 9 7. Display a farewell message to indicate the program has terminated normally. Use at least one constant variable to store value in the program, Following are 3 sample screen shots to illustrate the expected behavior of your program. Note: Your program must display the same information and formatted the same Comp 218/Winter 2022 Page 3 of 5 Assignment Welcome to Number Generator Program Now generating a 3-digit random number... The random number is : 738 The sum of the 3 digits is: 18 The substraction of the 3 digits is: -4 The multiplication of the 3 digits is: 168 The reminder ist Thank you for using Number Generator Program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
