Program In C to find out the factorial of any number

#include<stdio.h>
#include<conio.h>

int main()
{

int n, num;
long fact = 1;
printf(“Enter the number :”);
scanf(“%d”, &n);
num = n;
if (n<0)
printf(“No factorial of negative number\n”);
else
while (n > 1)
{

fact = fact*n;
n–;
}

printf(“Factorial of %d = %ld \ n”, num, fact);

return 0;

}

Leave a Reply

Your email address will not be published. Required fields are marked *