Write a java program to find no of the factorial.Here, no is to be find not the factorial.eg if 120 is given as no.its factorial is 5.
Answers
Answered by
0
Hey Friend !!☺
Here is your answer,
=》import java. util.*;
class Factorial
{
public static void main()
{
Scanner sc= newScanner (System.in);
int i, n, f=1;
System. out.Println ("Enter anumber ");
n=sc.nextInt ();
for (i=1;i <=n;i++)
{
f=f*i;
}
System. out.Println (" Factorial is " + f);
}
}
_________________________
I hope it helps
Thank you
Here is your answer,
=》import java. util.*;
class Factorial
{
public static void main()
{
Scanner sc= newScanner (System.in);
int i, n, f=1;
System. out.Println ("Enter anumber ");
n=sc.nextInt ();
for (i=1;i <=n;i++)
{
f=f*i;
}
System. out.Println (" Factorial is " + f);
}
}
_________________________
I hope it helps
Thank you
asinghal611:
hii priyanka..
Similar questions