[odd or even] Java编程【odd or even】White an application that reads two interger and determines and prints whether it's odd erven

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 12:42:09

[odd or even] Java编程【odd or even】White an application that reads two interger and determines and prints whether it's odd erven
[odd or even] Java编程
【odd or even】White an application that reads two interger and determines and prints whether it's odd erven

[odd or even] Java编程【odd or even】White an application that reads two interger and determines and prints whether it's odd erven
public class Test
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.println("Please input the first integer!");
int a = s.nextInt();
if(a % 2 == 0)
{
System.out.println(a + " is even!");
}
else
{
System.out.println(a + " is odd!");
}
System.out.println("Please input the first integer!");
int b = s.nextInt();
if(b % 2 == 0)
{
System.out.println(b + " is even!");
}
else
{
System.out.println(b + " is odd!");
}
}
}