I have code that generates 10 random numbers and I need to choose the first odd number in the list and print it out, but I'm not sure how to do that without using arrays or different functions. Any help would be greatly appreciated.
public class random_prime{
public static void main(String[] args){
final int LOW = 10;
final int HIGH = 90;
final int RANDOM_NUMS = 10;
//Generate 10 random numbers
for (int i = 0; i < 10; i++) {
int random = (int)(Math.random() * HIGH) + LOW;
System.out.print(random + " ");
}
}
}
Aucun commentaire:
Enregistrer un commentaire