Tengo el siguiente código y quiero hacer la suma y multiplicación de unas
matrices, pero al hacer el ciclo de los for anidados quiero que el resultado
se sume a la matríz siguiente. Y es aquí dónde no le halló como hacerle Por
su ayuda...muchas gracias...
#include<stdio.h>
#include<conio.h>
int matriz_1[3][3];
int matriz_2[3][3];
int resultado[3][3];
int i,j,k,l,r,p;
main()
{
/* arreglo 1*/
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Introduce dato %d: ", j+1);
scanf("%d",matriz_2[i][j];
}
}
/*arreglo 2*/
for(k=0;k<3;k++)
{
for(l=0;l<3;l++);
{
printf("Introduce dato %d:",k+1);
scanf("%d",matriz_2[k][l];
}
}
/* operaciones*/
/* algebra de matrices 3 x 3 */
/* suma */
for(r=0;r<3;r++)
{
for(p=0;p<3;p++)
{
for(i=0;i<3;i++)
for(k=0;k<3;k++)
{
for(j=0;j<3;j++)
for(l=0;l<3;l++)
resultado[r][p]=matriz_1[i][j]*matriz_2[k][l];
printf("%d ",resultado[r][p]);
}
}
}
Leer las respuestas