Datasets:

ArXiv:
License:
denisko's picture
cnanged dir structure and removed features file
3e77472
raw
history blame contribute delete
377 Bytes
import java.util.Scanner;
public class Factorial {
public static void main(String[] args) {
System.out.print("Enter a number: ");
Scanner input=new Scanner(System.in);
int num=input.nextInt();
long ans=factorial(n);
System.out.printf("Factorial of %d = %d", num, ans);
}
public static long factorial (int n){
return (n==1||n==0)? 1: factorial(n-1)*n;
}
}