Question: For this daily, write a program that will calculate and display N ! and the number of digits in the factorial. A CPP file (
For this daily, write a program that will calculate and display N and the number of digits in the factorial. A CPP file factorialdigits.cpp has been provided. It contains the declaration for an integer variable N and code that will ask the user to enter an integer value. Add code that will check the N value for validity. To be valid, the N value must be greater than or equal to and less than or equal to If an invalid N value is entered, display an error message and stop execution of the program. The error message displayed to the user MUST match the message that is displayed in the output below. Print a new line at the beginning and end of the error message. For a valid N value, write a loop to calculate N Remember that N is equal to the product of the values from through N for all N values that are greater than or equal to For N equal to Is equal to Once the factorial has been calculated, write code that will count the number of digits in the factorial. Finally, display the original N value, the factorial, and the number of digits as follows: Nvalue is equal to factorialvalue There are digits digits. where Nvalue is the original N value entered at the beginning of the program, factorialvalue is the calculated factorial, and digits is the number of digits in the factorial. Print a new line at the beginning and end of the output.
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
