procedure Mod (unsigned int M, N, unsigned int *result) begin *result = M - ((M/N) * N) end procedure writeu(unsigned int num) begin // write num with no leading spaces or zeroes. if (num > 10) writeu(num/10) endif Mod (num, 10, &num); put(num+'0'); end procedure printstring(char *s) begin int i; // print the string *literal* that is the parameter. i = 0 while (s[i] != 0) put(s[i]) i = i+1 endwhile end procedure newline() begin put(10) end procedure Gcd( unsigned int M, unsigned int N, unsigned int *result ) begin unsigned int Rem; while ( N > 0 ) Mod(M, N, &Rem); M = N; N = Rem; endwhile *result = M; end program begin 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(); end