GCD()

Fortran version:

    INTEGER FUNCTION  GCD( P, Q )
        INTEGER, INTENT( IN ) :: P, Q
    INTEGER FUNCTION  LCM( P, Q )
        INTEGER, INTENT( IN ) :: P, Q

C version:

    int GCD( const int *p, const int *q ) ;

Summary:

GCD() returns the greatest common divisor, and LCM() returns the least common multiple of integers P,Q.

For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    

Preconditions:

#include "iodecl3.h" if called from C.

Fortran Usage:

    ...
    ...
    INTEGER   GCD
    INTEGER   P, Q, D
    ...
    D = GCD( P, Q )   !  Now D is the gcd of P,Q
    ...

C Usage:

    ...
    #include "iodecl3.h"                          
    ...
    int  p, q, d ;
    ...
    d = GCD( &p, &q ) ; /*  Now d is GCD of p,q */
    ...


Previous: FIND1, FIND2, FIND3, FIND4

Next: GCTP

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages