#include
<stdio.h>
#include
<stdlib.h>
int
A[3][3],B[3][3],C[3][3],i,j ;
int
main(int argc, char *argv[])
{
for(i=0;
i<3; i++)
{
for(j=0;j<3;j++)
{
printf
("Matriks A[%d][%d] : ", i+1, j+1);
scanf("%d",
&A[i][j]);
}
}
printf("===================================================\n");
for(i=0;
i<3; i++)
{
for(j=0;j<3;j++)
{
printf ("Matriks
B[%d][%d] : ", i+1, j+1);
scanf("%d",
&B[i][j]);
}
}
printf("\n
Matriks A \n");
printf("================\n");
for
(i=0; i<3;i++)
{
for (j=0; j<3;j++)
{
printf("|%3d",A[i][j]);
}
printf("\n");
}
printf("\n
Matriks B \n");
printf("================\n");
for (i=0; i<3;i++)
{
for
(j=0; j<3;j++)
{
printf("|%3d",B[i][j]);
}
printf("\n");
}
printf("===================================================\n");
printf
("Penjumlahan Matriks A + B : \n");
for(i=0;
i<3; i++)
{
for(j=0;j<3;j++)
{
C[i][j] =
A[i][j]+B[i][j];
}
}
for
(i=0; i<3;i++)
{
for
(j=0; j<3;j++)
{
printf("|%3d",C[i][j]);
}
printf("\n");
}
system("PAUSE");
return 0;
}
No comments:
Post a Comment