diff --git a/README.md b/README.md index 984d969..8dc0ecf 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ The project includes implementations of the following mathematical algorithms: | [basic_operations.h](./src/basic_operations.h) | Basic operations, including rounding to a specified number of decimal places, nth root calculation, and logarithm calculation in a given base | | [combinatorics.h](./src/combinatorics.h) | Combinatorial analysis, including permutation, circular permutation, arrangement, and combination | | [factorial.h](./src/factorial.h) | Factorial calculation | -| [gcd.h](./src/gcd.h) | Least common multiple calculation | +| [gcd.h](./src/gcd.h) | Greatest common divisor calculation | | [geometry.h](./src/geometry.h) | Geometry-related functions, such as conversion between degrees and radians, distance between two points, midpoint between two points, slope of a line, angle of incline of a line, equation of a line, distance between a point and a line, circle perimeter calculation, number of diagonals in a polygon, sum of internal angles of a convex polygon, each internal angle of a regular polygon, and each external angle of a convex polygon | | [growth.h](./src/growth.h) | Growth calculations, including value after simple growth, rate of simple growth, value after compound growth, and rate of compound growth | | [happy_numbers.h](./src/happy_numbers.h) | Happy numbers determination | -| [lcm.h](./src/lcm.h) | Greatest common divisor calculation | +| [lcm.h](./src/lcm.h) | Least common multiple calculation | | [percentage.h](./src/percentage.h) | Percentage calculations, such as finding x percent of a number and determining what percentage one number represents of another | | [perfect_numbers.h](./src/perfect_numbers.h) | Perfect numbers determination | | [prime_factorization.h](./src/prime_factorization.h) | Prime factorization of numbers | diff --git a/src/lcm.h b/src/lcm.h index ced2837..6bd8e7b 100644 --- a/src/lcm.h +++ b/src/lcm.h @@ -2,7 +2,7 @@ #define LCM_H #include -#include +#include #include "gcd.h" /** @@ -18,8 +18,8 @@ long long lcm(int x, int y) { if (x == 0 || y == 0) return 0; - long long result; - result = abs(x * y / gcd(x, y)); + long long product = (long long) x * (long long) y; + long long result = llabs(product / gcd(x, y)); return result; }