+ 3
Tables in java
I'm trying to program a Table for a game in java, but thats the result of my code and I can't solve how to print it in matrix form instead of that column. Any idea what's happenning? Thx. https://code.sololearn.com/c5xLL1wm147B
3 ответов
+ 19
import java.util.*;
/**
 *
 * @author Bartokid
 */
public class soloLearn {
    /**
     * write 1 number then press enter an write the next number :)
     */
    public static void main(String[] args) {
      
        Scanner s = new Scanner(System.in);
        System.out.println("Escriba el numero de filas:");
        int columns=s.nextInt();
        System.out.println("Escriba el numero de columnas:");
        int lines=s.nextInt();
        System.out.println("Numero de Filas: "+ lines);
        System.out.println("Numero de columnas: "+ columns);
                    
            for(int i=0;i<columns;i++){
                for(int j=0;j<lines;j++){
                    System.out.print("| |\t");
                }
                 System.out.println("\n");
            }
}
}
+ 7
//i made this hope it helps
    int arr [][] = {{1,2,3,4},{3,2,1,0},{9,8,7,6}};
    
    for(int i = 0; i<arr.length;++i){
         
    for(int j = 0; j<arr[i].length;++j){
             
    System.out.print(arr[i][j]+" ");
     }
    System.out.println();
     }
+ 3
thanks you all, code edited :)
https://code.sololearn.com/c5xLL1wm147B



