mpz_t x; ... if (mpz_even_p(x)) { /* x is even */ } if (mpz_odd_p(x)) { /* x is odd */ }