047. Write a program to accept a number from user and print it’s factorial in C language

Eg: factorial of 5 is:-
5! = 5 * 4 * 3 * 2 * 1=120

#include<stdio.h>
#include<conio.h>
main()
{
	int i,fact=1,n;
	clrscr();
	printf("Enter number...");
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		fact=fact*i;
	printf("facttorialof the given number is...%d",fact);
	getch();
 
}

2 thoughts on “047. Write a program to accept a number from user and print it’s factorial in C language

Leave a Reply

Your email address will not be published. Required fields are marked *