|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
#include <cassert>#include <iostream>Functions | |
| unsigned int | gcd (unsigned int x, unsigned int y) |
| unsigned int | lcm (unsigned int x, unsigned int y) |
| void | tests () |
| int | main () |
Copyright 2020
A basic implementation of LCM function
| unsigned int gcd | ( | unsigned int | x, |
| unsigned int | y | ||
| ) |
Function for finding greatest common divisor of two numbers. @params two integers x and y whose gcd we want to find.
| unsigned int lcm | ( | unsigned int | x, |
| unsigned int | y | ||
| ) |
Function for finding the least common multiple of two numbers. @params integer x and y whose lcm we want to find.
| int main | ( | void | ) |
| void tests | ( | ) |
Function for testing the lcm() functions with some assert statements.