/* gcd.c */ /* calculates the gcd(x,y) */ /*---------------------------------------------------------------------------*/ #include #include /*---------------------------------------------------------------------------*/ void main() { int x= 13; int y= 11; while( x != y ) { if( x > y ) { x = x - y; } else { y = y - x; } } cout << "gcd is " << x << endl; } /*---------------------------------------------------------------------------*/