C Program to Calculate the Factorial of a number using Function. In this example, we will calculate the factorial of a number using function. Here we have used functions with Arguments and return value to perform this operation. We have declared a user-defined function fact which is called in the main function when printing the result. What is a Factorial of a Number? The factorial of a number is the product of all positive integers less than, equal to n. Factorial is denoted by the symbol '!'. Formula of factorial is n!=n x (n-1)! For example: 6!= 6 x 5 x 4 x 3 x 2 x1 = 720 PROGRAM TO CALCULATE THE FACTORIAL OF A NUMBER USING FUNCTION #include <stdio.h> #include <conio.h> int fact ( int ); void main () { int n ; printf ( "Enter the number : " ); scanf ( " %d " ,& n ); ...
Comments