Suma y Multiplicacion de Matrices php





















<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"  />

<title> Lea dos arreglos A y B de 5 filas y 5 columnas</title>
<style type="text/css">
<!--
.Estilo1 {color: #0000FF}
.Estilo2 {font-family: Arial, Helvetica, sans-serif}
body {
background-image: url(WP_YoshiMain_1280x1024_001.jpg);
}
.Estilo4 {font-family: "Comic Sans MS"; color: #006600; }
-->
</style>
<script language="javascript">
function validarEntero(valor){
     valor = parseInt(valor)
      if (isNaN(valor)) {
            return ""
      }else{
           return valor
      }
}

function validar(){

i1 = document.frmdatos.i1.value
i1 = validarEntero(i1)
document.frmdatos.i1.value=i1

if (i1==""){
alert("Debe introducir un números.")
document.frmdatos.i1.focus()
return 0;
}
}
</script>
</head>

<body bgcolor="#507FFF">

<form action="trabajo_6.php" method="post" name="frmdatos" id="frmdatos">
<table width="783" border="0" align="center">
  <tr>
    <td width="773"><h1 align="center" class="Estilo4">Matriz A 5*5 </h1>
      <table width="764" border="1" bordercolor="#006600" bgcolor="#FFFFFF">
        <tr>
          <td width="144"><span class="Estilo1">
            <label>
            <input type="text" name="i1" />
            </label>
          </span></td>
          <td width="144"><span class="Estilo1">
            <input type="text" name="i2" />
          </span></td>
          <td width="144"><span class="Estilo1">
            <input type="text" name="i3" />
          </span></td>
          <td width="144"><span class="Estilo1">
            <input type="text" name="i4" />
          </span></td>
          <td width="154"><span class="Estilo1">
            <input type="text" name="i5" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="i6" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i7" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i8" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i9" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i10" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="i11" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i12" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i13" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i14" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i15" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="i16" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i17" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i18" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i19" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i20" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="i21" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i22" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i23" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i24" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="i25" />
          </span></td>
        </tr>
      </table>    
      <h1 align="center" class="Estilo4">Matriz B 5*5 </h1>
      <table width="760" border="2" bordercolor="#006600" bgcolor="#FFFFFF">
        <tr>
          <td width="144"><span class="Estilo1">
            <label>
            <input type="text" name="b1" />
            </label>
          </span></td>
          <td width="144"><span class="Estilo1">
            <input type="text" name="b2" />
          </span></td>
          <td width="144"><span class="Estilo1">
            <input type="text" name="b3" />
          </span></td>
          <td width="144"><span class="Estilo1">
            <input type="text" name="b4" />
          </span></td>
          <td width="150"><span class="Estilo1">
            <input type="text" name="b5" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="b6" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b7" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b8" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b9" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b10" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="b11" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b12" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b13" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b14" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b15" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="b16" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b17" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b18" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b19" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b20" />
          </span></td>
        </tr>
        <tr>
          <td><span class="Estilo1">
            <input type="text" name="b21" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b22" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b23" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b24" />
          </span></td>
          <td><span class="Estilo1">
            <input type="text" name="b25" />
          </span></td>
        </tr>
      </table>    
      <h1 align="center" class="Estilo2"><label>
        <input name="Enviar" type="submit" id="ENVIAR" value="Enviar" onclick="validar()" />
      </label>
      </h1>      </td>
  </tr>
</table>




<p>&nbsp;</p>
</form>
</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
body {
background-image: url(WP_YoshiMain_1280x1024_001.jpg);
}
-->
</style></head>

<body>
<?php

$arreglo = array(array($_POST[i1],$_POST[i2],$_POST[i3],$_POST[i4],$_POST[i5]),array($_POST[i6],$_POST[i7],$_POST[i8],$_POST[i9],$_POST[i10]),array($_POST[i11],$_POST[i12],$_POST[i13],$_POST[i14],$_POST[i15]),array($_POST[i16],$_POST[i17],$_POST[i18],$_POST[i19],$_POST[i20]),array($_POST[i21],$_POST[i22],$_POST[i23],$_POST[i24],$_POST[i25]));


?>
<?php

$arreglo2 = array(array($_POST[b1],$_POST[b2],$_POST[b3],$_POST[b4],$_POST[b5]),array($_POST[b6],$_POST[b7],$_POST[b8],$_POST[b9],$_POST[b10]),array($_POST[b11],$_POST[b12],$_POST[b13],$_POST[b14],$_POST[b15]),array($_POST[b16],$_POST[b17],$_POST[b18],$_POST[b19],$_POST[b20]),array($_POST[b21],$_POST[b22],$_POST[b23],$_POST[b24],$_POST[b25]));


?>

<table width="200" height="382" border="1" align="center" bordercolor="#006600">
  <tr>
    <td>MATRIZ A 5*5 </td>
    <td>MATRIZ B 5*5 </td>
  </tr>
  <tr>
    <td><table width="569" height="212" border="1" bordercolor="#009900" bgcolor="#FFFFFF" align="center"
><?php
 echo "<tr>";
 for($i=0;$i<5;$i++){
for($j=0;$j<5;$j++){
echo "<td>",$arreglo[$i][$j],"</td>";
}
echo "<tr>";
}
?>

</table></td>
    <td><table width="569" height="212" border="1" bordercolor="#009900" bgcolor="#FFFFFF" align="center">
   
 <?php
 echo "<tr>";
 for($i=0;$i<5;$i++){
for($j=0;$j<5;$j++){
echo "<td>",$arreglo2[$i][$j],"</td>";
}
echo "<tr>";
}
?>

</table></td>
  </tr>
  <tr>
    <td>MATRIZ A+B </td>
    <td>MATRIZ A*B </td>
  </tr>
  <tr>
    <td> <table width="569" height="212" border="1" align="center" bordercolor="#009900" bgcolor="#FFFFFF">
        <tr>
          <td width="48" height="5"><?php  $_POST[c1] = ($_POST[i1] + $_POST[b1]);
                            echo $_POST[c1];?></td>
 <td width="50" height="5"><?php  $_POST[c2] = ($_POST[i2] + $_POST[b2]);
                            echo $_POST[c2];?></td>
          <td width="54" height="5"><?php  $_POST[c3] = ($_POST[i3] + $_POST[b3]);
                            echo $_POST[c3];?></td>
          <td width="61" height="5"><?php  $_POST[c4] = ($_POST[i4] + $_POST[b4]);
                            echo $_POST[c4];?></td>
 <td width="78" height="5"><?php  $_POST[c5] = ($_POST[i5] + $_POST[b5]);
                            echo $_POST[c5];?></td>
      </tr><tr>
 <td width="48" height="5"><?php  $_POST[c6] = ($_POST[i6] + $_POST[b6]);
                            echo $_POST[c6];?></td>
 <td width="50" height="5"><?php  $_POST[c7] = ($_POST[i7] + $_POST[b7]);
                            echo $_POST[c7];?></td>
 <td width="54" height="5"><?php  $_POST[c8] = ($_POST[i8] + $_POST[b8]);
                            echo $_POST[c8];?></td>
 <td width="61" height="5"><?php  $_POST[c9] = ($_POST[i9] + $_POST[b9]);
                            echo $_POST[c9];?></td>
 <td width="78" height="5"><?php  $_POST[c10] = ($_POST[i10] + $_POST[b10]);
                            echo $_POST[c10];?></td>
    </tr><tr>
 <td width="48" height="5"><?php  $_POST[c11] = ($_POST[i11] + $_POST[b11]);
                            echo $_POST[c11];?></td>
 <td width="50" height="5"><?php  $_POST[c12] = ($_POST[i12] + $_POST[b12]);
                            echo $_POST[c12];?></td>
 <td width="54" height="5"><?php  $_POST[c13] = ($_POST[i13] + $_POST[b13]);
                            echo $_POST[c13];?></td>
 <td width="61" height="5"><?php  $_POST[c14] = ($_POST[i14] + $_POST[b14]);
                            echo $_POST[c14];?></td>
 <td width="78" height="5"><?php  $_POST[c15] = ($_POST[i15] + $_POST[b15]);
                            echo $_POST[c15];?></td>
    </tr><tr>
 <td width="48" height="5"><?php  $_POST[c16] = ($_POST[i16] + $_POST[b16]);
                            echo $_POST[c16];?></td>
 <td width="50" height="5"><?php  $_POST[c17] = ($_POST[i17] + $_POST[b17]);
                            echo $_POST[c17];?></td>
 <td width="54" height="5"><?php  $_POST[c18] = ($_POST[i18] + $_POST[b18]);
                            echo $_POST[c18];?></td>
 <td width="61" height="5"><?php  $_POST[c19] = ($_POST[i19] + $_POST[b19]);
                            echo $_POST[c19];?></td>
 <td><?php  $_POST[c20] = ($_POST[i20] + $_POST[b02]);
                            echo $_POST[c20];?></td>
    </tr><tr>
 <td><?php  $_POST[c21] = ($_POST[i21] + $_POST[b21]);
                            echo $_POST[c21];?></td>
 <td><?php  $_POST[c22] = ($_POST[i22] + $_POST[b22]);
                            echo $_POST[c22];?></td>
 <td width="54" height="5"><?php  $_POST[c23] = ($_POST[i23] + $_POST[b23]);
                            echo $_POST[c23];?></td>
 <td><?php  $_POST[c24] = ($_POST[i24] + $_POST[b24]);
                            echo $_POST[c24];?></td>
          <td width="78" height="5"><?php  $_POST[c25] = ($_POST[i25] + $_POST[b25]);
                            echo $_POST[c25];?></td>
        </tr>
    </table> </td>
    <td><table width="569" height="212" border="1" align="center" bordercolor="#009900" bgcolor="#FFFFFF">
        <tr>
          <td width="17" height="5"><?php  $_POST[d1] = ($_POST[i1] * $_POST[b1]);
                            echo $_POST[d1];?></td>
 <td width="17" height="5"><?php  $_POST[d2] = ($_POST[i2] * $_POST[b2]);
                            echo $_POST[d2];?></td>
          <td width="17" height="5"><?php  $_POST[d3] = ($_POST[i3] * $_POST[b3]);
                            echo $_POST[d3];?></td>
          <td width="17" height="5"><?php  $_POST[d4] = ($_POST[i4] * $_POST[b4]);
                            echo $_POST[d4];?></td>
 <td width="17" height="5"><?php  $_POST[d5] = ($_POST[i5] * $_POST[b5]);
                            echo $_POST[d5];?></td>
        </tr><tr>
 <td width="17" height="5"><?php  $_POST[d6] = ($_POST[i6] * $_POST[b6]);
                            echo $_POST[d6];?></td>
 <td width="17" height="5"><?php  $_POST[d7] = ($_POST[i7] * $_POST[b7]);
                            echo $_POST[d7];?></td>
 <td width="17" height="5"><?php  $_POST[d8] = ($_POST[i8] * $_POST[b8]);
                            echo $_POST[d8];?></td>
 <td width="17" height="5"><?php  $_POST[d9] = ($_POST[i9] * $_POST[b9]);
                            echo $_POST[d9];?></td>
 <td width="17" height="5"><?php  $_POST[d10] = ($_POST[i10] * $_POST[b10]);
                            echo $_POST[d10];?></td>
    </tr><tr>
 <td width="17" height="5"><?php  $_POST[d11] = ($_POST[i11] * $_POST[b11]);
                            echo $_POST[d11];?></td>
 <td width="17" height="5"><?php  $_POST[d12] = ($_POST[i12] * $_POST[b12]);
                            echo $_POST[d12];?></td>
 <td width="17" height="5"><?php  $_POST[d13] = ($_POST[i13] * $_POST[b13]);
                            echo $_POST[d13];?></td>
 <td width="17" height="5"><?php  $_POST[d14] = ($_POST[i14] * $_POST[b14]);
                            echo $_POST[d14];?></td>
 <td width="17" height="5"><?php  $_POST[d15] = ($_POST[i15] * $_POST[b15]);
                            echo $_POST[d15];?></td>
    </tr><tr>
 <td width="17" height="5"><?php  $_POST[d16] = ($_POST[i16] * $_POST[b16]);
                            echo $_POST[d16];?></td>
 <td width="17" height="5"><?php  $_POST[d17] = ($_POST[i17] * $_POST[b17]);
                            echo $_POST[d17];?></td>
 <td width="17" height="5"><?php  $_POST[d18] = ($_POST[i18] * $_POST[b18]);
                            echo $_POST[d18];?></td>
 <td width="17" height="5"><?php  $_POST[d19] = ($_POST[i19] * $_POST[b19]);
                            echo $_POST[d19];?></td>
 <td width="17" height="5"><?php  $_POST[d20] = ($_POST[i20] * $_POST[b20]);
                            echo $_POST[d20];?></td>
    </tr><tr>
 <td width="17" height="5"><?php  $_POST[d21] = ($_POST[i21] * $_POST[b21]);
                            echo $_POST[d21];?></td>
 <td width="17" height="5"><?php  $_POST[d22] = ($_POST[i22] * $_POST[b22]);
                            echo $_POST[d22];?></td>
 <td width="17" height="5"><?php  $_POST[d23] = ($_POST[i23] * $_POST[b23]);
                            echo $_POST[d23];?></td>
 <td width="17" height="5"><?php  $_POST[d24] = ($_POST[i24] * $_POST[b24]);
                            echo $_POST[d24];?></td>
          <td width="17" height="5"><?php  $_POST[d25] = ($_POST[i25] * $_POST[b25]);
                            echo $_POST[d25];?></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>


Aplicacion hecha en Macromedia Dreamwaver
lenguaje:php  y html
descripcion:imprime dos matrices de 5*5 utilizando un formulario previo
donde realiza una suma de matrices y una multiplicacion de matrices

Comentarios

  1. Interesante la aplicación, cómo la ejecuto?

    Los textos antes y después de las imágenes son los archivos? qué nombre y extensiones? gracias.

    ResponderEliminar

Publicar un comentario

Entradas populares de este blog

Google Glass llegará al mercado en 2014

Como sobrevivir a mi ex