1 #include <iostream> 2 using namespace std; 3 4 int gcd(int m , int n) 5 { 6 int r; 7 while(n!=0) 8 { 9 r = m%n; 10 m = n; 11 n = r; 12 gcd(m,n); 13 } 14 return m; 15 } 16 17 int main(int argc, char* argv[]) 18 { 19 cout << gcd(4,2) << endl; 20 return 0; 21 }