/******************************************
 This Program gets two positive integers
 from the user and computes their GCD.
 ******************************************/
#include <iostream>
using namespace std;

int getposint();

int main()
{
  int a = getposint(), b = getposint();
  
  // Compute gcd
  while(b != 0)
  {
    int r = a % b;
    a = b;
    b = r;
  }

  // Write out gcd
  cout << "The gcd is " << a << endl;

  return 0;
}

/******************************************
 This function get's a positive integer
 from the user
 ******************************************/
int getposint()
{
  int k;
  cout << "Enter a positive integer: ";
  cin >> k;
  while(k <= 0)
  {
    cout << "I said *positive*, try again: ";
    cin >> k;
  }

  return k;
}