import java.util.*;
class Factorial
{
public static void main(String args[])
{
int n,fact;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number:");
n=sc.nextInt();
fact=sc.nextInt(n);
System.out.println("Factorial="+fact);
}
static int facto (int n)
{
int t,fact=1;
for(i=1;i<=n;i++)
{
fact=fact*i;
}
return fact;
}
}
class Factorial
{
public static void main(String args[])
{
int n,fact;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number:");
n=sc.nextInt();
fact=sc.nextInt(n);
System.out.println("Factorial="+fact);
}
static int facto (int n)
{
int t,fact=1;
for(i=1;i<=n;i++)
{
fact=fact*i;
}
return fact;
}
}
No comments :
Post a Comment