/* C Program to calculate factorial using while loop */
Factorial of a whole number ‘n’ is defined as the product of that number with every whole number till 1. For example, the factorial of 4 is 4×3×2×1, which is equal to 24. It is represented using the symbol ‘!’ So, 24 is the value of 4!, so in c program to write print the factorial number of any number you should write a c program like this…
#include<stdio.h> #include<conio.h> void main() { int i, num, fact=1; system("cls"); printf("\nEnter a numbers: "); scanf("%d",&num); for(i=2; i<=num; i++) fact = fact * i; printf("\n Factorial of %d is %d",num,fact); getch(); }
run
Enter a number: 5
Factorial of 5 is 120
——————————–