Resources » Articles/Knowledge Sharing » Computer & Technology

C program of finding factorial by using recursion


Posted Date: 15-Mar-2008  Last Updated:   Category: Computer & Technology    
Author: Member Level: Gold    Points: 3



/* Calculate factorial by using recursion */
#include
#include

int fact(int k)
{
if(k==0)
return 1;
else
return k*fact(k-1);
}

void main()
{
int n;
clrscr();
printf("\n Enter a number :");
scanf("%d",&n);
printf("\n Factorial value=%d",fact(n));
getch();
}


Output:
Enter a number :6
Factorial value=720


Did you like this resource? Share it with your friends and show your love!




Responses to "C program of finding factorial by using recursion "
Guest Author: Nilesh M     08 Mar 2013
program of factorial in c using class and its sample is very nice, I like this article and site - good piece of work here. thanks


Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.