33: W.A.P. to read number & find its factorial.
Please follow me for more practicals....
Program:
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int num, f = 1;
printf("Enter num = ");
scanf("%d", &num);
for (int i = 1; i <= num; i++)
{
f = f * i;
}
printf("\nFactorial = %d", f);
getch();
}
Please follow me for more practicals....
Output:
Enter num = 5
Factorial = 120
Please follow me for more practicals....
Algorithm:
1.
START
2.
Declare num, i = 1, f = 1.
3.
Enter the num.
4.
Repeat up-to step-6 until i <= num.
5.
f = f * i.
6.
i++.
7.
Display f.
8.
STOP.
Please follow me for more practicals....
Flowchat: