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

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/14 03:50:49

[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!");
}
}
}