mardi 6 décembre 2016

Create an array of 10 integers, and fill it with random numbers ranging between 1 and 6

it gives 0 when I print but I initialize it in 0

import java.security.SecureRandom;
public class HW{
   public static void main(String args[]) {
     SecureRandom randomNumbers =new SecureRandom();
     int A[] =new int[11];
     for (int roll=1;roll<=6;roll++) {
         A[roll] = randomNumbers.nextInt(6);
     }
     for(int Array=1;Array<A.length;Array++) {
        System.out.printf("%4d%10d%n", Array,A[Array]);
     }
   } 
}




Aucun commentaire:

Enregistrer un commentaire