- Main Page
- Classes
- Files

# 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 }