Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me Write a program that will calculate the factorial of number. Exam

ID: 3647261 • Letter: P

Question

Please help me
Write a program that will calculate the factorial of number.
Example: the factorial of 5 is 5 * 4 * 3 * 2 * 1 = 120

? Input the starting number in main()
? Pass the number to a function called factorial() to calculate the Factorial number

Prototype: double factorial (double num);
In the function:
? Use a for loop to calculate the answer
? Use a return statement to return the answer back to the caller.
? Back in main, ask the user if they want to another enter number. (Use a loop in main())

thanks

Explanation / Answer

#include "stdafx.h" #include #include using namespace std; void fact(); int no=0,fa=1,i; void main() { fact(); getch(); } void fact() { coutno; for(i=no; i>=1; i--) { fa=fa*i; } cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote