In the following program, the result prints from 1 to 49.Now, the task is to pri
ID: 3647126 • Letter: I
Question
In the following program, the result prints from 1 to 49.Now, the task is to print the random numbers like....5,7,10,13,14.....It must be random. and also the task is not to choose the initial and final random number.You can change any syntax to print result in random numbers.I believe someone will able to do this.
class arrayloto
{
public static void main(String[] args)
{
int[] lotonum = new int [];
for (int i = 0; i<lotonum.length; i++ ){
lotonum[i] = i+1;
int result= 0;
result += lotonum[i];
System.out.println(result);}
}
}
Explanation / Answer
import java.util.Random; /** Generate 10 random integers in the range 0..99. */ public final class RandomInteger { public static final void main(String... aArgs){ log("Generating 10 random integers in range 0..99."); //note a single Random object is reused here Random randomGenerator = new Random(); for (int idx = 1; idxRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.