Java判断数字的奇偶
package anli; import java.util.Scanner; public class jiou { public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println("请输入一个整数: "); long number = scan.nextLong(); String check = (number % 2 ==0) ?"这个数字是:偶数":"这个数字是奇数: "; System.out.println(check); } }
笃信仁厚,慎思勤勉