-----------------------------------------------------
-- GCD: Algorithm (C-like)
-----------------------------------------------------

0: int  x, y;
1: while (1) {
2:   while (!go_i);
3:   x = x_i; 
4:   y = y_i;
5:   while  (x != y)  {
6:       if  (x < y)    
7:          y = y - x;
          else             
8:          x = x - y;
       }
9:    d_o = x;
    }

-----------------------------------------------------
-- GCD: C
-----------------------------------------------------

#include <stdio.h>

int gcd(int x, int y)
{
  while (x!=y) x<y ? y-=x : x-=y;
  return x;
}

int main()
{
  int  xx, yy;
  char go;

  while (1)
  {
    do
    {
      printf("Press 1 and Enter to start...\n");
      scanf("%c%*c", &go);
    }while(go!='1');

    do
    {
      printf("Insert the first value >0 and press Enter: \n");
      scanf("%d%*c", &xx);
    while(xx<=0);

    do
    {
      printf("Insert the second value >0 and press Enter: \n");
      scanf("%d%*c", &yy);
    while(yy<=0);

    printf("GCD is %d\n", gcd(xx, yy));

    return 0;
}
