You have to take an integer as input and print true if it is an even number and false otherwise.
Input Format
For each test case, you will be given an integer input.
Constraints
-2^31 <= Integer Input <=2^31 -1
Output Format
true or false accordingly
Sample Input 0
22
Sample Output 0
true
Explanation 0
Since 22 is an even number so we print true.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner (System.in);
int i=sc.nextInt();
if(i%2==0){
System.out.print("true");
}
else{
System.out.print("false");
}
}
}


0 Comments