Factorial Program using Java
This Program is used to calculate the Factorial of Given Number.
import java.io.*;
class da
{
public static void main(String arg[]) throws IOException
{
DataInputStream d = new DataInputStream(System.in);
int i,n,f;
String s;
f=1;
System.out.print("enter the number : ");
s = d.readLine();
n = Integer.parseInt(s);
for(i=1;i<=n;i++)
{
f = f * i;
}
System.out.println("\n"+"factorial of given number "+n+" is : " +f);
}
}