Calculate the factorial of a non-negative integer without using the built in function factorial
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers123
Suggested Problems
-
Return the 3n+1 sequence for n
8534 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1329 Solvers
-
Back to basics 21 - Matrix replicating
1823 Solvers
-
Create a vector whose elements depend on the previous element
805 Solvers
-
Reverse the elements of an array
1144 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I dont understand what you wanted to do with your test no.4. why dont you just check our answer against the actual factorial, instead of hard coding (truncated) numbers?
testcase is nok:
6.6895e+198==factorial(120)
ans =
0
Use if statement for test 4...
Faulty test case has been corrected. Those who have solved with respect to the rounded test case kindly solve the question again. It's a fairly simple one!