Problem 1749. Factorial !
Calculate the factorial of a non-negative integer without using the built in function factorial
Solution Stats
Problem Comments
- 
		4 Comments
 
		    Show
		    1 older comment
		  
		  
		Frequency Domain
    	on 25 Jul 2013
	
	
  	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?
		Marcel
    	on 3 Jan 2014
	
	
  	testcase is nok:
6.6895e+198==factorial(120)
ans =
     0
		Björn
    	on 11 Dec 2015
	
	
  	Use if statement for test 4...
		Dyuman Joshi
    	on 8 Mar 2021
	
	
  	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!
Solution Comments
Show commentsProblem Recent Solvers119
Suggested Problems
- 
         
         
20311 Solvers
 - 
         
Create a square matrix of multiples
487 Solvers
 - 
         
Generate a vector like 1,2,2,3,3,3,4,4,4,4
12979 Solvers
 - 
         
The Answer to Life, the Universe, and Everything
560 Solvers
 - 
         
         
362 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!