• 周六. 10 月 12th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

Java entry process if – odd even number

King Wang

1 月 3, 2022
import java.util.Scanner;
public class IfTest01 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println(" Please enter an integer !");
int number = sc.nextInt();
if(number % 2 == 0){
System.out.println(number+" even numbers ");
}else{
System.out.println(number+" Odd number ");
}
}
}

demo>java IfTest01.java
Please enter an integer !
129
129 Odd number
 

发表回复