diff --git a/ExtendedEuclideanAlgo/ExtEuc.cpp b/ExtendedEuclideanAlgo/ExtEuc.cpp new file mode 100644 index 0000000..cbddd42 --- /dev/null +++ b/ExtendedEuclideanAlgo/ExtEuc.cpp @@ -0,0 +1,24 @@ +// Author : EUNIX-TRIX + +#include +using namespace std; + +int gcd(int a, int b, int & x, int & y) { + if (a == 0) { + x = 0; + y = 1; + return b; + } + int x1, y1; + int d = gcd(b % a, a, x1, y1); + x = y1 - (b / a) * x1; + y = x1; + return d; +} + +int main(){ + int x,y,X,Y; + cin>>x>>y; + cout<