Learn C ProgrammingLearn ProgrammingPrograms On More On FunctionsResources

065. Write a program to print factorial of a given number using recursive function in C language

By September 18, 2012 September 5th, 2018 No Comments
#include<stdio.h>
#include<conio.h>  
#include<process.h>

int fact(int n)
{
	int f;
	if(n==1)
		return 1;
	else
		f=n*fact(n-1);
	return f;
}
main()
{
	int n;
	clrscr();
	printf("Enter number : ");
	scanf("%d",&n);
	printf("\nFactorial is...%d\n",fact(n));
	getch();
}


Leave a Reply

DEMO01