Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 432 Bytes

Facto_Search.md

File metadata and controls

18 lines (15 loc) · 432 Bytes

import java.util.Scanner;

public class FactorialSearch {

public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    long n = Integer.parseInt(scanner.nextLine().trim());
    System.out.println(factorial(n));
}

public static long factorial(long n) {
    long fact = 1;
    for (int i = 1; i <= n; i++) {
        fact *= i;
    }
    return fact;
}

}