+ 12
Help me, Make a code to generate 5 random number between 1 to 10, With no repleting in java.
9 Antworten
+ 9
@Serena Thank you mam, Yes it is homework but i promise, i will learn from your code not copy it. Thank you very much for quick replies, you are very good at java :)
+ 8
@Serena Thanks, It is working but i want it to print output in single line.
Like: 1,7,3,5,2
Can you help mam ?
+ 6
@Tosif
i have tried
System.out.print(list+",");
but i was printing a extra coma,
@IshqGamer Your code do not generate 5 random number.
But no worry my question solve by @Serena already :)
+ 1
@fuyuka it's simple to print into sequence, use "print" instead of "println".
eg. System.out.print(""); 😉
0
@Fuyuka it's because you putted coma between double inverted coma, left it blank.
i.e. int i=2;
System.out.print(i); //i=2
//output : 2
System.out.print(i+",");
//output : 2,
System.out.print(i + "," + i);
//output : 2,2
0
@Fuyuka im sorry that i didnt help u in this looks like i didnt understand what u meant. thx