#include void PrintFactorial(int factCounter, int factValue){int nextCounter;int nextValue;if (factCounter == 0) { // Base case: 0! = 1printf("1\n");}else if (factCounter == 1) { // Base case: Print 1 and resultprintf("%d = %d\n", factCounter, factValue);}else { // Recursive caseprintf("%d * ", factCounter);nextCounter = factCounter - 1;nextValue = nextCounter * factValue;/* Your solution goes here */}}int main(void) {int userVal;scanf("%d", &userVal);printf("%d! = ", userVal);PrintFactorial(userVal, userVal);return 0;}
void PrintFactorial(int factCounter, int factValue){int nextCounter;int nextValue;
if (factCounter == 0) { // Base case: 0! = 1printf("1\n");}else if (factCounter == 1) { // Base case: Print 1 and resultprintf("%d = %d\n", factCounter, factValue);}else { // Recursive caseprintf("%d * ", factCounter);nextCounter = factCounter - 1;nextValue = nextCounter * factValue;
/* Your solution goes here */
}}
int main(void) {int userVal;
scanf("%d", &userVal);printf("%d! = ", userVal);PrintFactorial(userVal, userVal);
return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here