//-------------------------------------------------------------------
//	testgcd.c		(revised version of our 'gcdcalc.c')
//
//	This program accepts two integers as command-line arguments,
//	then it computes and displays their greatest common divisor.
//
//	      compile using:  $ gcc testgcd.c gcd.s -o testgcd
//	      execute using:  $ ./testgcd <int1> <int2>
//
//	programmer: ALLAN CRUSE
//	written on: 29 MAR 2006
//-------------------------------------------------------------------

#include <stdio.h>	// for printf(), atoi() 

extern int gcd( int, int );

/*
int gcd( int m, int n )
{
	int	p = ( m < 0 ) ? -m : m;
	int	q = ( n < 0 ) ? -n : n;
	while ( q != 0 ) { int r = p % q; p = q; q = r; }
	return	p;
}
*/

int main( int argc, char **argv )
{
	if ( argc < 3 ) return 1;

	int	m = atoi( argv[1] );
	int	n = atoi( argv[2] );
	int	g = gcd( m, n );

	printf( "\n\n gcd( %d , %d ) = %d \n\n", m, n, g );
}