Assume the availability of a function called fact. The function receives an int
ID: 3537886 • Letter: A
Question
Assume the availability of a function called fact. The function receives an int argument and returns an int value. A void function is acceptable. If the argument is one or smaller, it returns the integer value one. Otherwise it returns the product of all the integers from one to its argument.So the value of fact(4) is 1*2*3*4 and the value of fact(10) is 1*2*3*4*5*6*7*8*9*10.
Write a recursive function and a main program to test. Upload the cpp file Assume the availability of a function called fact. The function receives an int argument and returns an int value. A void function is acceptable. If the argument is one or smaller, it returns the integer value one. Otherwise it returns the product of all the integers from one to its argument.
So the value of fact(4) is 1*2*3*4 and the value of fact(10) is 1*2*3*4*5*6*7*8*9*10.
Write a recursive function and a main program to test. Upload the cpp file
Explanation / Answer
#include #include void main() { int n,fact; int rec(int); clrscr(); cout>n; fact=rec(n); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.