import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
                public static void main(String[] args) {
                           //     System.out.println("Hello world!");
                            System.out.println("Enter the number for factorial") ;
                            Scanner n = new Scanner(System.in);
                            int num = n.nextInt();
                                    n.close();
                            int fact = 1 ;
                        int originalnumber = num;
                                        while (num > 0) {
                                            fact = fact*num;
                                            num--;
                                        }
                            System.out.println("Factoral of " +originalnumber+ " is :"+fact) ;
}
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: