Members BookmarksPolls Fresher Jobs Funny Pictures MCA Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

Advertisements


website counter



Program to calculate factorial of a given number


Posted Date: 26 May 2008    Resource Type: Articles/Knowledge Sharing    Category: Education

Posted By: Vidya       Member Level: Diamond
Rating:     Points: 1



Program : Program to calculate factorial of a given number


/**********************************************************************/
/*Program : To show recursion*/
/*Purpose : Program to calculate factorial of a given number*/
/*Date : 19-12-2004*/
/*Time : 05:10*/
/**********************************************************************/
#include
#include

/********** Function Declaration begins **********/
int factorial(int);
/********** Function Declaration ends **********/

void main()
{
int n, fact;
clrscr();
printf(“\n\t\t Program to calculate the factorial of a number:”);
printf(“\n\n\t\t Enter number to calculate the factorial:”);
scanf(“%d”,&n);
fact =factorial(n);
printf(“Factorial of %d = %d”,n,fact);
getch();
}


/********** Computing Factorial **********/
/********** Function Definition begins **********/
int factorial( int n )
{
if ( n == 0 )
return 1;
else
return n* factorial(n-1);
}
/********** Function Definition ends **********/

? OUTPUT
Program to calculate the factorial of a number:
Enter number to calculate the factorial:7
Factorial of 7 = 5040





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: M.Sc Wood Science & Technology
Previous Resource: Program to compute minimum spanning tree using prims technique.
Return to Discussion Resource Index
Post New Resource
Category: Education


Post resources and earn money!
 
Related Resources


Contact Us    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.