i need to generate 4 numbers between 20 to 100 and to print all of them . after that i need to print and to know who the random number that his sqrt the closet one to the number that my ''man'' chose on the start . i know what i want to do but i didnt succeed. help thanks hi , i need to generate 4 numbers between 20 to 100 and to print all of them . after that i need to print and to know who the random number that his sqrt the closet one to the number that my ''man'' chose on the start . i know what i want to do but i didnt succeed. help thanks
public class RandomNumbers {
public static void main(String[] args){
for(int i = 0; i < 5; i++){
System.out.println((int)((Math.random() * 81) + 20));
}
}
Aucun commentaire:
Enregistrer un commentaire