/******************************************
 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;
}