source file name: factfn.cpp
#include<iostream.h>
#include<conio.h>
int main()
{
void fact(int);
int n;
clrscr();
cout<<" enter any no:";
cin>>n;
fact(n);
getch();
return 0;
}
void fact(int n)
{
int f=1;
for(;n>0;n--)
f=f*n;
cout<<"\n factorial value: "<<f;
}
output:
0 Comments
Post a Comment