+ 2

Factorial of number

2nd Mar 2018, 10:56 AM
harsha
2 odpowiedzi
+ 15
with recursion , here is 1-liner fact (n) { return n==0?1:n*fact(n-1); } without recusion , int fact =1 ; for ( ;n>1;n--) fact*=n; System.out.println(fact);
2nd Mar 2018, 1:04 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 14
here it is described well https://www.sololearn.com/learn/CPlusPlus/1641/?ref=app if you found any problem to understand this you can comment again I'll help you
2nd Mar 2018, 11:01 AM
GAWEN STEASY
GAWEN STEASY - avatar