In this HackerEarth Factorial! problem solution you have been given a positive integer N. You need to find and print the Factorial of this number. The Factorial of a positive integer N refers to the product of all numbers in the range from 1 to N.


hackerEarth Factorial! problem solution


HackerEarth Factorial! problem solution.

import java.io.*;
import java.util.*;
class example_2
{
    static Scanner sc=new Scanner(System.in);

    public static void main(String args[]) throws Exception
    {
        long n=sc.nextLong(),prod=1;
        for(long i=1;i<=n;i++)
        {
            prod=prod*i;
        }
        System.out.println(prod);
    }
}