0
How to print factorial of n with decrease order of supposed factorial of 5 is first then fact of 4..3..2..etc
4 Respuestas
+ 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);
}
}
}
+ 1
Use While/For loop
0
find range factorials normally, append the numbers to a list/array/vector and then reverse it.
0
Thanks