Java program to find Factorial of a Input number

      No Comments on Java program to find Factorial of a Input number
import java.util.Scanner;
class scan
{
public static void main(String arg[])
{int x,i;
double y=1;
Scanner kb=new Scanner(System.in);
System.out.println("Enter Number To Find Factorial");
x=kb.nextInt();
for(i=x;i>=1;i--)
 {
   y=y*i;
 }
System.out.println("Factorial of given number is:- "+y);
}
}

OUTPUT:-

scanfcode

Leave a Reply

Your email address will not be published. Required fields are marked *