#include <stdio.h>
int is_odd(unsigned n);
int is_even(unsigned n);
int is_even(unsigned n)
{
return n == 0 ? 1 : is_odd(n-1);
}
int is_odd(unsigned n)
{
return n == 0 ? 0 : (n == 1 ? 1 : is_even(n-1));
}
int main(void)
{
unsigned num;
num = 17;
printf("%u is %s\n", num
, is_even
(num
) ? "even" : "odd");
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgaXNfb2RkKHVuc2lnbmVkIG4pOwppbnQgaXNfZXZlbih1bnNpZ25lZCBuKTsKCmludCBpc19ldmVuKHVuc2lnbmVkIG4pCnsKICAgIHJldHVybiBuID09IDAgPyAxIDogaXNfb2RkKG4tMSk7Cn0KCmludCBpc19vZGQodW5zaWduZWQgbikKewogICAgcmV0dXJuIG4gPT0gMCA/IDAgOiAobiA9PSAxID8gMSA6IGlzX2V2ZW4obi0xKSk7Cn0KCmludCBtYWluKHZvaWQpCnsKICAgIHVuc2lnbmVkIG51bTsKICAgIAoJbnVtID0gMTc7CiAgICBwcmludGYoIiV1IGlzICVzXG4iLCBudW0sIGlzX2V2ZW4obnVtKSA/ICJldmVuIiA6ICJvZGQiKTsKICAgIAogICAgcmV0dXJuIDA7Cn0K