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
State whether the following statement is True or False :
The number of iteration refers to the number of times the condition is met.
Radhika is writing a program in Java to print her name 10 times. Suggest her the appropriate condition for the same.
The .......... is a logical situation where either of the two actions are to be performed depending on certain condition.
Name the expression that is used to initialize a loop variable.