KnowledgeBoat Logo

Computer Applications

Naina has written a program in which she has entered one number. She wants to check whether the entered number is divisible by 2 or not. Suggest her the appropriate condition for the same.

Java Conditional Stmts

59 Likes

Answer

Naina can use the below if condition:

if (number % 2 == 0)
    System.out.println("Number is divisible by 2");
else
    System.out.println("Number is not divisible by 2");

Answered By

37 Likes


Related Questions