miércoles, 15 de marzo de 2017

Tabla numeros 3x3

<html>
    <head>
    <title>Tabla numeros 3x3</title>
    </head>
    <body>
            <script type="text/javascript">
        //OBJETO ARRAY DE DIMENSION 5
        var tnumeros=new Array(new Array(3),new Array(3),new Array(3));
        var i,j;
        //petición de datos por teclado
        for(i=0;i<3;i++){//bucle control filas
           for(j=0;j<3;j++){//bucle control columnas
             tnumeros[i][j]=parseInt(prompt('Dame un número: ',''));
                }
           }
           //mostrar contenido de la tabla
           for(i=0;i<3;i++){//buble control filas
                for(j=0;j<3;j++){//bucle control columnas
                    document.write(tnumeros[i][j],',');
                }
                document.write('<br>');
           }

        </script>
    </body>
</html>

No hay comentarios:

Publicar un comentario