#### Question

Impliment class GCD which have member function (a/c), which calculate greatest common divisor of two number entered during program execution. Print( ) will Print GCD of two number.

#### Solution

```
#include<iostream.h>
class gcd
{
int a, b;
public :
void print ( );
};
void gcd :: print (void)
{
cin >> a >> b;
while (a ! = b)
{
if (a > b)
a – = b;
if (b>a)
b – = a;
}
cout << a;
void main ( )
{
gcd obj;
obj.print ( );
}
```

Is there an error in this question or solution?

#### APPEARS IN

Solution Impliment class GCD which have member function (a/c), which calculate greatest common divisor of two number entered during program execution. Print( ) will Print GCD of two number. Concept: C++ Programming.