C & C++ language
Home
HTML
C&C++ language
Movies
Games
Softwares
Saturday, 20 October 2012
FACTORIAL USING FUNCTION
#include<iostream.h>
int fac(int a);
int fact=1,a;
void main()
{
int result;
result=fac(fact);
cout<<result;
}
int fac(int a)
{
int n;
cout<<"enter the value of n to fnd its factorial : ";
cin>>n;
for(int i=1;i<=n;i++)
fact=fact*i;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment