1.判断变量是否为奇数偶数。
package com.JAVA;import java.util.Scanner;public class text {public static void main(String[] args) {System.out.print("请输入一个数:");Scanner s=new Scanner(System.in); int x=s.nextInt();if (x%2==0){System.out.println("您输入的"+x+"为偶数");}else{System.out.println("您输入的"+x+"为奇数");}}}