Factorial Of Number

in Hindi - Factorial Of Number



not yet

Source Code :

RUNimport java.util.Scanner;

public class Factorial
{
public static void main(String args[])
{
int a,fact;

System.out.println("Enter the number : ");
Scanner enter = new Scanner(System.in);
a = enter.nextInt();

fact=factorial(a);

System.out.println("Factorial of " + a + " is " + fact);
}

static int factorial (int x)
{
int f;
if(x==1){
return (1);
}
else{
f=x*factorial(x-1);
}
return(f);
}
}