istinishat

Extent Euclid

Nov 6th, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int gcd (int a, int b, int & x, int & y) {
  2.     if (a == 0) {
  3.         x = 0; y = 1;
  4.         return b;
  5.     }
  6.     int x1, y1;
  7.     int d = gcd (b%a, a, x1, y1);
  8.     x = y1 - (b / a) * x1;
  9.     y = x1;
  10.     return d;
  11. }
Add Comment
Please, Sign In to add comment