Below is the program to find factorial of a number using function in C language. The program has been compiled and executed in Dev C++. The function is a block of code that is specifically designed to do a certain task. Here, the function is taking an argument and calculating the factorial returning its resulting value. Function may or may not return a value explicitly. But it will always return an exit code depending on execution.


void main(){
int a,f;
int fact(int);
printf("Enter a number:");
printf("Factorial= %d", f);

//function fact taking an integer argument to calculate it's factorial.
int fact(int x) 
int fac=1,i;
return fac; // returning the fact value.


factorial using functions in C

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.