C++ functions

0 kunal bali · February 14, 2015
Finally made the source code for finding a factorial of a number by making a function(UDF)

well here's the source code for c++ boreland turbo c++ 4.5 


-----------------------------------------------------------

#include<iostream.h>
#include<conio.h>
double factorial(double n)
{
double counter,fac=1;

for(counter =1;counter<=n;counter++)
{
fac=counter*fac;
}
cout<<"the factorial of the no is "<<fac;
return 0;
}
void main()
{
double x;
cout<<"Enter the number:";
cin>>x;
factorial(x);
}
---------------------------------------------------------------------

 *****output******
 enter the number: 6
 The factorial of this number is:720 


Post a Reply

Replies

Oldest  Newest  Rating
0 Jay Deshaun · February 14, 2015
Nice
  • 1

C++

107,131 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator