English, asked by rishilaugh, 1 year ago

write a program to find factorial of a number


Anonymous: c++ program,or java progam or wht??
ananya071: java

Answers

Answered by ananya071
8
public class factorial
{
public static void main(int n)
{
int a=n, f=1;
while(a>0)
{
f=f*a;
a--;
}
System. out. println("factorial of a number"+f) ;
}
}
Answered by Anonymous
0

Explanation:

 \bf \huge \pink{dur} \red{ga} \:  \green{cha}uhan

To understand this example, you should have the knowledge of the following C programming topics:

C Data Types

C Programming Operators

C if...else Statement

C for Loop

The factorial of a positive number n is given by:

factorial of n (n!) = 1 * 2 * 3 * 4....n

The factorial of a negative number doesn't exist. And, the factorial of 0 is 1.

Similar questions