-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path138.cpp
More file actions
53 lines (39 loc) · 1007 Bytes
/
138.cpp
File metadata and controls
53 lines (39 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<iostream>
using namespace std;
class Number
{
private:
int iNo; // Characteristic
public:
// Behaviour
void Accept() // Setter Method
{
cout<<"Enter the value: "<<endl;
cin>>this->iNo;
}
void Display() //Getter Method
{
cout<<"Value is: "<<this->iNo<< endl;
}
int Factorial()
{
int iFact = 1;
int iCnt = 0;
for(iCnt= 1 ;iCnt <= iNo ; iCnt++)
{
iFact *= iCnt; //iFact = iFact * iCnt;
}
return iFact;
}
};
int main()
{
Number nobj;
int iRet = 0;
//Cout<<nobj.iNo;
nobj.Accept();
nobj.Display();
iRet = nobj.Factorial();
cout<<"Factorial is : "<<iRet<<endl;
return 0;
}