-
//判断是否为奇数和偶数
-
import java.util.Scanner;
-
public class jsos {
-
public static void main(String[] args) {
-
System.out.print("请输入一个数字:");
-
Scanner i=new Scanner(System.in);
-
int num=i.nextInt();
-
if (num<=0) {
-
System.out.print("请输入正整数!");
-
}else if (num%2==0) {
-
System.out.print("“"+num+"”"+"为偶数!");
-
}else {
-
System.out.print("“"+num+"”"+"为奇数!");
-
}
-
}
-
}