Last active
November 9, 2024 05:15
-
-
Save ghost355/f11dcaebcc0f21c39dad0087dcc35d0b to your computer and use it in GitHub Desktop.
Nod НОД теорема Евклида рекурсия
This file contains hidden or 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
#include<stdlib.h> | |
int nod(int x, int y) { | |
int a = abs(x); | |
int b = abs(y); | |
if (b > a) { | |
int temp = b; | |
a = b; | |
b = temp; | |
} | |
return b==0 ? a : nod(b, a%b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment