Computer Science, asked by sumana2001, 1 year ago

calculate factorial of the given number using c


sumana2001: 5 .
Sunandit: complete the question
sumana2001: calculate the factorial of 5 using c
Sunandit: c = combination????
sumana2001: computer language
sumana2001: c,c++
sumana2001: etc
Sunandit: ok
Sunandit: i dont know computer sorry
Sunandit: i had not opted for that when i was in 11

Answers

Answered by kunalp
1
Program to find factorial using C:-

#include<stdio.h>
long factorial(int);
main()
{ int number;
long fact = 1;
   printf("Enter a number to calculate it's factorial\n");
   scanf("%d",&number);
   printf("%d! = %ld\n", number, factorial(number));
return 0;
}
long factorial(int n)
{
int c;

long result = 1;

for( c = 1 ; c <= n ; c++ )
        result = result*c;

return ( result );
}

sumana2001: thanks a lot
kunalp: Please mark it as a brainliest.
iqbal111: please mark brainliest
Similar questions