This question requires the realization of a function to determine whether the integer entered by the disk is an even number, if it is an even number, return true, otherwise return false.
Function interface definition:
public static boolean isOdd(int data)
Description: Data is the parameter passed in by the user. The value of data does not exceed the range of int. The function must return true or false.
裁判测试程序样例:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int data=in.nextInt();
System.out.println(isOdd(data));
}
/* 请在这里给出isOdd(i)函数 */
}
Input sample: 8
Output sample: true
public static boolean isOdd(int data){
if(data%2==0){
return true;
}else{
return false;
}
}