1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| import java.util.Random;
public class MainTeste {
int nbrAleatoire;
int valeur;
int[][] grille;
static int ligne=0;
static int colonne=0;
static int ligne2=0;
static int colonne2=0;
public static void main(String[] args) {
System.out.println("salut");
int grille[][] = new int[3][3];
while(ligne2<3)
{
while(colonne2<1)
{
for(int x=0; x<grille.length; x++)
{
for(int y=0; y<grille.length; y++)
{
Random nbrAleatoire = new Random();
int valeur = 1 + nbrAleatoire.nextInt(9);
grille[x][y] = valeur;
}
ligne2++;
}
colonne2++;
}
}
System.out.println("valeur dans la case:"+grille[1][1]);
while(ligne<3)
{
while(colonne<1)
{
for(int i=0; i<grille.length; i++)
{
for(int j=0; j<grille.length; j++)
{
System.out.print("|case:"+grille[i][j]+"|");
}
System.out.println("");
ligne ++;
}
System.out.println("");
colonne ++;
}
}
}
} |
Partager