You are given an integer as input. Your task is to determine whether the number is even or odd. If the number is even, print 'true'. Otherwise, print 'false'.
Boolean type and operations. True and false
Checking if a number is even or odd
Report a typo
Sample Input 1:
2Sample Output 1:
trueSample Input 2:
5Sample Output 2:
falseWrite a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Create a Scanner object for taking input
Scanner scanner = new Scanner(System.in);
// Take integer input from the user
int number = scanner.nextInt();
// Use a simple way to determine if the number is even or odd.
// If it's even, print true, otherwise, print false
// Write your code here
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.