Computer Science, asked by bhumi7915, 9 months ago

write a slab program using if else statement.

Answers

Answered by Anonymous
1

Answer:

Explanation:

When we need to execute a set of statements based on a condition then we need to use control flow statements. For example, if a number is greater than zero then we want to print “Positive Number” but if it is less than zero then we want to print “Negative Number”. In this case we have two print statements in the program, but only one print statement executes at a time based on the input value. We will see how to write such type of conditions in the java program using control statements.

Answered by Anonymous
6

Hello!

Your program :

{

public class IfStatementExample {

public static void main(String args[]){

{

int num=70;

if( num < 100 ){

/* This println statement will only execute,

* if the above condition is true

*/

System.out.println("number is less than 100");

}

}

Thank you!

Similar questions