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

#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

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