when i enter some values i get the answer but other values no,the system stay blocked
int pgcdfon(mpz_t a, mpz_t b, mpz_t *x, mpz_t *y) {
if (mpz_cmp_ui(a, 0) == 0) {
mpz_set_ui(*x, 0);
mpz_set_ui(*y, 1);
return b;
}
mpz_t x1, y1, res, h;
mpz_init(x1);
mpz_init(y1);
mpz_init(res);
mpz_t o;
mpz_init(o);
mpz_init(h);
mpz_mod(res, b, a);
int pgcd = pgcdfon(res, a, &x1, &y1);
mpz_div(o, b, a);
mpz_mul(h, o, x1);
mpz_sub(*x, y1, h);
mpz_set(*y, x1);
return pgcd;
}
void main() {
mpz_t x, y, q, w, g;
mpz_init(x);
mpz_init(y);
mpz_init(q);
mpz_init(w);
mpz_init(g);
gmp_printf("donner q \n ");
gmp_scanf("%Zd", &q);
gmp_printf("donner w \n");
gmp_scanf("%Zd", &w);
mpz_set(g, (pgcdfon(q, w, &x, &y)));
gmp_printf("\n\n pgcd de (%Zd, %Zd) = %Zd \n\n", q, w, g);
}