Question: I tried converting my code from a for loop to a while loop but couldn't. it's supposed to loop back to while loop created by
I tried converting my code from a for loop to a while loop but couldn't. it's supposed to loop back to while loop created by my instructor. all the for loops have to be changed to while loop. please help if you can. below is my code.
Scanner scan=new Scanner(System.in);
Random random=new Random();
int number,rand;
int []count=new int[]{0,0,0,0,0,0};
number=scan.nextInt();
for(int i=0;i { rand=1+random.nextInt(6); count[rand-1]++; } System.out.println("The chart of "+number+" throws"); for(int i=0;i<6;i++) { System.out.print(i+1+" "); for(int j=0;j System.out.print("*"); System.out.println(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
