Write a program to find the factorial of a number.
Answers
Answered by
4
Explanation:
C program to find factorial of a number
long factorial(int);
int main() { int n;
printf("Enter a number to calculate its factorial\n"); scanf("%d", &n);
printf("%d! = %ld\n", n, factorial(n));
return 0; }
long factorial(int n) { int c; long r = 1;
for (c = 1; c <= n; ..
......
Answered by
0
Write a program to find the factorial of a number.
class Factorial
{
public static void main(int n)
{
long f=1L;
int i;
for(i=1;1<=n;i++)
f=f*i;
System.out.println("Factorial = "+f);
}
}
Similar questions
English,
3 months ago
English,
3 months ago
Math,
6 months ago
Math,
6 months ago
CBSE BOARD XII,
1 year ago