Created
June 26, 2020 11:42
-
-
Save carlopi/569bb93fd08cc2f5a792a6d3fdb4e60b to your computer and use it in GitHub Desktop.
gcd.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[cheerp::jsexport]] int gcd(int a, int b) | |
{ | |
//Euclidean algorithm to compute Greatest Commond Divisor | |
while (b) | |
{ | |
int temp = a % b; | |
a = b; | |
b = temp; | |
} | |
return a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment