Find Factorial Of N Positive Number In C language(Loops)
Write a C program to find factorial of given positive number:
Answer:
#include <stdio.h>
int main()
{
int n;
int factorial = 1;
scanf("%d", &n);
for (int i = n; i >= 1; i--)
{
factorial = factorial * i ;
}
printf("%d", factorial);
return 0;
}
Now just enter the number and check the result. Thank you

Comments
Post a Comment