C PRACTICAL / FIND FACTORIAL OF A NUMBER USING RECURSION

hello friends....

TAKE THE FIRST STEP TO KNOWLEDGE FRIENDS BECAUSE KNOWLEDGE IS FREE.

>> /* WRITE A PROGRAM TO FIND FACTORIAL OF A NUMBER USING RECURSION. */

#include<stdio.h>
#include<conio.h>
int fact();
void main()
{  int n;
   clrscr();
   printf("enter your value : \n");
   scanf("%d",&n);
   printf("factorial ans is : %d",fact(n));
   getch();
}

int fact(n)
{
   if(n>0)
     return(n*fact(n-1));
   else
     return(1);
}

    /*  OUTPUT  */
==========================

enter your value : 
5
factorial ans is : 120

* * * * * * * * * * * * * *
http://www.dnpdeveloper.com

if you have like this blog so share and subscribe, comment for this blog.
if your any question, so comment pleass.
MY INSTAGRAM ID : dnp176

Comments