Matriz 3×3

[aux_code language=»javascript» theme=»tomorrow» title=»Matriz 3×3″ extra_classes=»»]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static double[][] matriz = new double[3][3];

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        for (int x = 0; x < matriz.length; x++) {
            for (int y = 0; y < matriz[x].length; y++) {
                System.out.println("Intro valor " + x + ", " + y);
                matriz[x][y] = Double.parseDouble(br.readLine());
            }
        }
        visualizar();
    }

    private static void visualizar() {
        for (double[] doubles : matriz) {
            System.out.format("%.1f %.1f %.1f%n", doubles[0], doubles[1], doubles[2]);
        }

    }
}
[/aux_code]
Etiquetas: Sin etiquetas

Añadir un comentario

Debes estar conectado para publicar un comentario