ش | ی | د | س | چ | پ | ج |
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
package com.company;
public class Main {
public static void main(String[] args) {
// write your code here
for (int i = 0; i <= 40; i++) {
System.out.println(
"\n *** " +
i +
" ! = " +
recursive_factorial(i) +
" ***");
}
}
public static long recursive_factorial(int n) {
if (n == 0) // Base case return 1;
else return n *
recursive_factorial(n - 1); // Recursive call }
}