#include <stdio.h>
void
put (int c)
{
  fputc (c, stdout);
}

void
Mod (unsigned int M, unsigned int N, unsigned int *result)
{
  *result = M - ((M / N) * N);
}

void
writeu (unsigned int num)
{
  Mod (num, 10, &num);
  put (num + '0');
}

void
printstring (char *s)
{
  int i;
  i = 0;
  while (s[i] != 0)
    {
      put (s[i]);
      i = i + 1;
    }
}
void
newline (void)
{
  put (10);
}

void
Gcd (unsigned int M, unsigned int N, unsigned int *result)
{
  unsigned int Rem;
  while (N > 0)
    {
      Mod (M, N, &Rem);
      M = N;
      N = Rem;
    }
  *result = M;
}

int
main (int argc, char **argv)
{
  unsigned int val;
  Gcd (45, 35, &val);
  printstring ("Gcd( 45, 35 ) = ");
  writeu (val);
  newline ();
  Gcd (1989, 1590, &val);
  printstring ("Gcd( 1989, 1590 ) = ");
  writeu (val);
  newline ();
  exit (0);
  return (0);
}