Question
Another common interview question is to ask the candidate to write a program that calculates the factorial of a number. This is commonly asked because
Another common interview question is to ask the candidate to write a program that calculates the factorial of a number. This is commonly asked because of its surprisingly rich variety of possible solutions. The way a candidate approaches solving this problem is telling of their skill level and gives the interviewer information for further questioning. A reminder about how factorial is calculated. It is represented as a number followed by an exclamation mark: 5!. A factorial is calculated by multiplying all of the whole numbers from the given number down to 1. Example: 5! = 5 * 4 * 3 * 2 *1 = 120 Your program will do the following: 1. Your main function will calculate the factorial of 10 by calling the Factorial function you will write. 2. The value the Factorial function returns is displayed to the terminal. See Expected Output for details. You may not use notes or other sources of information, but you may use the compiler to check your work. Turn in your completed .cpp file to TITANium to receive credit. Requirements Your program must have the following attributes: 1. The program must include and call a function named Factorial. It takes in an integer that will be used to calculate the factorial. It returns the answer as an integer. 2. You are free to implement the solution using any of techniques you have learned. (No hard coding program output) 3. Output must be similar to Expected Output. 4. All code should adhere to good coding style guidelines. Expected Output Result: 3628800
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started