C Program to Find Factorial of a Number using While Loop
C Program to Find Factorial of a Number using While Loop
Posted By Manisha Gupta
The factorial of a positive integer n is equal to 1*2*3*...n. You will learn to calculate the factorial of a number using for loop in this example.

PROGRAM:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| #include<stdio.h> #include<conio.h> void main() { int n,i,f; f=i=1; clrscr(); printf ( "Manisah Enter a Number to Find Factorial: " ); scanf ( "%d" ,&n); while (i<=n) { f*=i; i++; } printf ( "The Factorial of %d is : %d" ,n,f); getch(); } |
OUTPUT:
Manisha Enter a Number to Find Factorial: 5 The Factorial of 5 is : 120
Flowchart to Find Factorial of a Number
