Ad

Chapter - 4: The Loop Control Structure

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


Ad
B
Sections
2
Exercises
#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;
}
Ad

© 2024 Garbage Valuegarbage value logo