repl.it
@katiewinton/

Where is the 8?

Java

No description

fork
loading
Files
  • Main.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Main {
  public static void main(String[] args) {
    int rowsAndColumns = 30;
    int oddOneOut = Math.random() * (rowsAndColumns*rowsAndColumns)+ 1;
    int counter = 0;
    for(int r = 0; r < rowsAndColumns; r++){
      String row = "";
      for(int c = 0; c < rowsAndColumns; c++){
        counter += 1;
        if(counter == oddOneOut){
          row += " 8";
        } else{
          row += " 0";
        }
      }
      console.log(row);
    }
  }
}
?