Factorial:

==> Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n

Image description

Example Program:

package day1;

import java.util.Scanner;
public class Factorial
{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.println("Enter the factorial number");
int n=scan.nextInt();
long Factorial=1;
for(int i=1; i<=n; i++)
{
Factorial=Factorial*i;
}
System.out.println(Factorial);
}
}

Output:

Image description