/* C++ program for calculating factorial of a number entered by the user */
# include < iostream.h>
# include < conio.h>
void fact(int);
void main()
{
clrscr();
int n;
cout < < "Enter limit : ";
cin>>n;
fact(n);
getch();
}
void fact(int x)
{
char a;
int i=1;
for(int j=1;j< =x;j++)
{
i*=j;
}
cout< < "Answer = "< < i< < endl;
cout< < "Want to continue ( y )/or press any key to continue ";
cin>>a;
if(a=='y')
{
main();
}
else
{
cout< < "Good Bye ";
}
getch();
}
Tuesday, February 12, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
can you help me on my project?please please
Post a Comment