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
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);
}
}
© 2024 OneMinuteCode. All rights reserved.