I completed the task of making a program that calculates the factorial of a number.
I learnt the Mastery Topic #13 & #16, do while loops and recursions.
I created a function called factorial that used a recursion to repeat the same operation several times. This is my function:
int factorial (int n){
int answer;
answer=1;
while (n>1){
answer = answer * n;
n=n-1;
}
return answer;
}
I did a do-while loop to keep asking the user if they would like the program to calculate a factorial of a number again.
For this assignment I learnt what an unsigned integer is, as well as a char
Muy bien explicado tu post, gracias me sirvió mucho
Me gustaLe gusta a 1 persona
Pingback: Calculadora Factorial – RON
Thank you, this really helped me.
Me gustaLe gusta a 1 persona
Thank you for sharing this post. Your program helped me understand how the do-while function works.
Me gustaLe gusta a 1 persona
Pingback: Factorial Calculator – Inplamura
Gracias por compartir, lo hiciste muy sencillo y fácil de entender, me ayudó mucho
Me gustaMe gusta