diff --git a/chapters/fundamental_algorithms/euclidean_algorithm/euclidean.md b/chapters/fundamental_algorithms/euclidean_algorithm/euclidean.md index 54be87366..8dce30b7b 100644 --- a/chapters/fundamental_algorithms/euclidean_algorithm/euclidean.md +++ b/chapters/fundamental_algorithms/euclidean_algorithm/euclidean.md @@ -114,3 +114,85 @@ int main(){ } ``` + +### C +```c +#include +#include + +int euclid_mod(int a, int b){ + + int temp; + while (b != 0){ + temp = b; + b = a%b; + a = temp; + } + + return a; +} + +int euclid_sub(int a, int b){ + + while (a != b){ + if (a > b){ + a = a - b; + } + else{ + b = b - a; + } + } + + return a; +} + +int main(){ + + int check = euclid_mod(64*67, 64*81); + int check2 = euclid_sub(128*12, 128*77); + + printf("%d\n", check); + printf("%d\n", check2); +} + +``` + +### JavaScript + +```html + + + + + + +```