import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
static int Factorial(int n){
if (n==0)
{
//bcoz 0 and 1 factorial is 1
return 1;
}
int d = Factorial(n-1);
int multi = n * d;
System.out.println(multi);
return multi;
}
public static void main(String[] args) {
System.out.println("Hello world!");
int answer = Factorial (5);
System.out.println(answer);
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: