C Language is Basic Language .. Many Advanced Language have come still if u can understand basic language carefully u can do all other languages in easy way. So here is our efforts of giving programs which are well executed in our Rubal Solutions Server and confirm to be running successfully. we have our c programming full tutorial on rubal solutions you tube channel. u can learn theory and practical’s from there … ask any queries if needed.
Factorial Program in C
A Useful and Popular Program in C Programming .
Factorial of number is 123*4….n
To find factorial of a number , u should have knowledge about loops, conditions , operators , data types.
Let’s develop Program for Finding Factorial till given n number in C
#include <stdio.h>
int main()
{
printf("Welcome to Rubal Solutions!\n\n");
printf("Do Like Share Comment Subscribe and Support !\n\n");
int num, iter;
long fact = 1; // initializing factorial to 1
printf("Enter a positive integer: ");
scanf("%d",&num);
if (num < 0) // If the user enters a negative number
printf("The factorial of a negative number does not exist\n");
else
{
for(iter = 1; iter <= num; iter++)
{
fact = fact*iter;
}
printf("The factorial of %d is %lu\n", num, fact);
}
return 0;
}
![](https://i0.wp.com/rubalsolutions.com/wp-content/uploads/2020/09/1-2.png?resize=868%2C428&ssl=1)
![](https://i0.wp.com/rubalsolutions.com/wp-content/uploads/2020/09/2-2.png?resize=976%2C513&ssl=1)
![](https://i0.wp.com/rubalsolutions.com/wp-content/uploads/2020/09/3-2.png?resize=976%2C514&ssl=1)
1,289 total views, 1 views today
No Responses