Popular C Program – Factorial in C

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;
}

 1,289 total views,  1 views today

No Responses

Leave a Reply

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

About This Site

We are Rubal Solutions.

A Youtuber Content Creator .

Make Videos On Various Education and Knowledgeable Content.

Rubal Solutions Youtube Videos
Follow and Support On

Address:

Facebook- https://www.facebook.com/rubalsolutions/

Twitter – https://twitter.com/ruby0071

Instagram – https://www.instagram.com/rubalsolutions

Blogger – https://rubalsolutions.blogspot.com/