#include<stdio.h>
#include<conio.h>
#define maks 3
main()
{
int mat1[maks][maks],mat2[maks][maks]. mathasil[maks][maks];
int b,k;
printf("Pengisian matrik 1 ; \n");
for(b=0;b<maks;B++)
{
for(k=0;k<maks;k++)
{
printf("Matrik [%d,%d]:",b,k);
scanf("%d",&mat1[b][k]);
}
}
printf("pengisian matrik 2 ; \n");
for(b=0;b<maks;b++)
{
for(k=0;k<maks;k++)
{
printf("Maktrik [%d,%d]:",b,k);
scanf("%d",&mat2[b][k]);
}
}
// awal operasi pertambahan matrik
for(b=0;b<maks;b++)
for(k=0;k<maks;k++)
mathasil[b][k]=mat1[b][k]+mat2[b][k];
// akhir operasi perhitungan
printf("matrik 1 :\n")
for(b=0;b<maks;b++)
{
for(k=0;k<maks;k++)
{
printf("%6d",mat1[b][k]);
}
printf("\n");
}
printf("matrik 2 :\n")
for(b=0;b<maks;b++)
{
for(k=0;k<maks;k++)
{
printf("%6d",mat2[b][k]);
}
printf("\n");
}
printf("matrik hasil :\n")
for(b=0;b<maks;b++)
{
for(k=0;k<maks;k++)
{
printf("%6d",mathasil[b][k]);
}
printf("\n");
}
getch();
return 0 ;
}
Tidak ada komentar:
Posting Komentar