Answer to Question #251574 in Java | JSP | JSF for AYESHA

Question #251574

Write a Java program that implements a function Check Even Odd that checks that a number input by user is even or odd


1
Expert's answer
2021-10-16T01:38:10-0400


import java.util.Scanner;


public class App {


	public static void main(String[] args) {


		Scanner keyBoard = new Scanner(System.in);
		System.out.print("Enter a number: ");
		int number = keyBoard.nextInt();
		CheckEvenOdd(number);
		keyBoard.close();
	}


	private static void CheckEvenOdd(int number) {
		if (number % 2 == 0) {
			System.out.println("The number " + number + " is even.");
		} else {
			System.out.println("The number " + number + " is odd.");
		}
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS