Answer to Question #328146 in Java | JSP | JSF for Michael Parenas

Question #328146

In reference to your module #2,Create a simple program that will print ODD or EVEN when you enter a number.

1
Expert's answer
2022-04-13T10:33:06-0400
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.print("Enter number: ");
        int number=scan.nextInt();
        if(number%2==0){
            System.out.println("EVEN");
        }
        else{
            System.out.println("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