public static boolean q8(int n){ boolean check=true; if((n/10)<0){ return check; } int f=n%10; int r=(n/10)%10; if((f%2==0)&&(r%2==0)){ return check=false; } q8(n/10); return check; }

the recursion need to get a number and return true if each pair of digits are one even and the other odd.

false if not.

how can i write it better ?for example:for the number 230 -->return true(which is correct)

but for the number 243---->return true(which should be false) cause it takes 2 and 0 from the begining.

how can i rewrite correct?

--- Update ---

this is my second try.it works only if the numbers is false.on true numbers it doesnt work?public static boolean q8(int n){ int f=n%10; int r=(n/10)%10; if((f%2==0)&&(r%2==0)&&((n/10)>0)){ return false; } return q8(n/10); }

any idea how to correct me?