Java numeric range output

Asked 2 years ago, Updated 2 years ago, 24 views

I want to print out the range by comparing random numbers to the number entered in Java, but how do I print out the range?

For example, if you enter a number out of 0 to 99 numbers, and the number is larger than the random number, I want to print out 0 to the next line like this line

java

2022-09-22 08:06

1 Answers

Use the following code to generate random numbers! The range output is a simple code that you can use conditional statements, so I won't write it down additionally ㅇㅅㅇ)>

import java.util.Random;

public class ClassName {
    public static void main(String[] args) {
        Random rd = new Random();

        //assign one random integer between 0 and 99 to randomInt
        int randomInt = rd.nextInt(100);
    }
}


2022-09-22 08:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.