import java.io.*;
class factorial
{
public static void main(String args[]) throws IOException
{
System.out.println("Enter a number: ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
int s=1;
for(int i=1;i<=num;i++)
{
s=s*i;
}
System.out.println("Factorial is "+s);
}
}
class factorial
{
public static void main(String args[]) throws IOException
{
System.out.println("Enter a number: ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
int s=1;
for(int i=1;i<=num;i++)
{
s=s*i;
}
System.out.println("Factorial is "+s);
}
}
0 comments:
Post a Comment