English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

can we do it using loops?

2007-03-15 06:02:11 · 2 answers · asked by sunil y 1 in Computers & Internet Software

2 answers

required program is given below
just save it into a [ .CPP ] file and run it


#include
#include
class x
{
int f,s,i;
public:
void fact(int s);
};
void x::fact(int s)
{
f=1;
for(i=s;i>=1;i--)
f*=i;
cout<<"Factorial of "< }
void main()
{clrscr();
x fe;
int v;
cout<<"Enter the no."< cin>>v;
fe.fact(v);
getch();
}

2007-03-15 06:23:04 · answer #1 · answered by Vuggy -'D' 1 · 0 0

//DON'T FORGET TO CHOOSE AS BEST ANSWER
//-Amazing!! http://scti-education.org/knowledge.html
//-Free softwares!! http://scti-education.org/download.html


#include
#include
void main()
{
clrscr();
int num,i,j,fact=1;
cout<<"Enter the number \t ";
cin>>num;

for(i=n;i>=1;i--)
{
fact=fact*i;
}

cout<<"\n Factorial of "<
getch();
}

2007-03-19 02:51:53 · answer #2 · answered by Dheeraj 2 · 0 0

fedest.com, questions and answers