29 lines
577 B
Java
29 lines
577 B
Java
public class Parity {
|
|
|
|
public static boolean even(int n) {
|
|
switch (n) {
|
|
case 0:
|
|
return true;
|
|
case 1:
|
|
return false;
|
|
default:
|
|
return even(n-2);
|
|
}
|
|
}
|
|
|
|
public static boolean odd(int n) {
|
|
switch (n) {
|
|
case 0:
|
|
return false;
|
|
case 1:
|
|
return true;
|
|
default:
|
|
return even(n-2);
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(even(64));
|
|
}
|
|
}
|