How to print factorial of n with decrease order of supposed factorial of 5 is first then fact of 4..3..2..etc | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print factorial of n with decrease order of supposed factorial of 5 is first then fact of 4..3..2..etc

11th Jul 2019, 11:50 PM
Prathamesh Pawar
4 Answers
+ 3
public class Program { public static void main(String[] args) { printFactorial(5); } static void printFactorial(int num){ if(num > 1){ System.out.print(num+"."); printFactorial(num-1); }else{ System.out.println(num); } } }
12th Jul 2019, 1:17 AM
Om Kumar
Om Kumar - avatar
+ 1
Use While/For loop
12th Jul 2019, 2:24 AM
Ujjwal
Ujjwal - avatar
0
find range factorials normally, append the numbers to a list/array/vector and then reverse it.
12th Jul 2019, 12:43 AM
Choe
Choe - avatar
0
Thanks
12th Jul 2019, 2:23 AM
Prathamesh Pawar