Question
Create a user defined function that calculates the factorial of a given integer. (without pointers) Your program should accomplish the following: a. You must create
Create a user defined function that calculates the factorial of a given integer. (without pointers)
Your program should accomplish the following: a. You must create a user defined function, with a single input and a return type of integer. -The integer input will be the value of n. b. In the main, ask user for the value of n, then call the function in the main program to calculate the factorial and print to screen. c. Inside of your user defined function, calculate the factorial utilizing a loop. Start your loop at 1, and set the initial value of the factorial to 1 (Due to: 0! = 1). make sure to 'return' the calculated value back to your main program (integer) d. Code should be uploaded as a .txt file, with a screenshot of your console showing your factorial output. e. Provide comments on the basic structure of your loop and how it calculates the factorial.
3. Create a user defined function that calculates the factorial of a given integer. (with pointers)
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