gcd.hpp File Reference

Go to the source code of this file.

Functions

int gcd (int n, int m)


Function Documentation

int gcd ( int  n,
int  m 
)

Compute greatest-common-denominator.

Parameters:
n 
m 

Definition at line 3 of file gcd.cpp.

00004 {
00005   if (n < 0)
00006     n = -n;
00007   while (m != 0) {
00008     int tmp(n % m);
00009     n = m;
00010     m = tmp;
00011   }
00012   return n;
00013 }


Generated on Sun Nov 30 10:06:52 2008 for Calculator by  doxygen 1.5.3