Factorial
Lesson 5 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.
Challenge
EasyWrite a function named fact that gets an integer num and returns the factorial of num.
Factorial of n is the product of all the numbers 1 to n
Examples,
fact(4)->24= 1 * 2 * 3 * 4fact(6)->720= 1 * 2 * 3 * 4 * 5 * 6
Factorial of n is written, in math, n!
The factorial of 0 is 1.
Try it yourself
int fact(int num) {
// Write code here
}All lessons in Recursion Challenges - Master The Recursive Thinking
1Easy Challenges
Fibonacci SequenceIs PalindromeLongest Common PrefixMerge Two Sorted ListsFactorialFirst Occurrence in String