Computer Science, asked by shashirawat8378, 1 year ago

Write a program on Java to show flow of numbers (if else statement)

Answers

Answered by lastbenchstudent
0

import java.util.Random;

public class Branch {

public static void main(String[] args) {

Random r = new Random();

int num = r.nextInt();

if (num > 0) {

System.out.println("The number is positive");

} else {

System.out.println("The number is negative");

}

Similar questions