import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入数字");
int a=sc.nextInt();
if (a%2==0) {
System.out.println("偶数");
}else{
System.out.println("奇数");
}
}
}
if(变量%2 == 0){
return "偶数";
}else{
return "奇数";
}
能被2整除就是偶数,不然就是奇数。这还有什么好问的看看不懂吗