Chapter - 4: The Loop Control Structure

Write a program to find the factorial value of any number entered through the keyboard.


B
Sections
2
Exercises

A

B

C

D

E

1

2

3

4

5

6

7

8

9

#include<stdio.h>
#include<conio.h>
int main()
{
	int i,num, fact;
	
	printf("\nEnter a number : ");
	scanf("%d", &num);
	
	fact = num;
	for(i = 1; i < num; i++)
		fact *= i;
		
	printf("%d is the factorial of %d",fact, num);
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo