CONTOH MATRIKS

/*meitanisyah_G64090021*/

#include
main()
{
int i=1,j=1;
int m, n;
int k, l;
int z[100][100], x[100][100], c[100][100] ;
int jumlah=0;
printf("matriks z");
printf(" ukuran matriks (mxn) = ");
scanf("%d %d", &m, &n );
printf("matriks x");
printf(" ukuran matriks (kxl) = ");
scanf("%d %d", &k, &l );
if (m==k && n==l)
{
printf("\nmasukkan data matriks z\n");
for (i=1; i<=m; i++) // masukkan data matriks Z
for (j=1; j<=n; j++){
scanf("%d", &z[i][j]);}
printf("\nmasukkan data matriks x\n");
for (i=1; i<=k; i++) // masukkan data matriks X
for (j=1; j<=l; j++){
scanf("%d", &x[i][j]); }
printf("\nhasil penjumlahan kedua matriks \n");
for(i=1; i<=m; i++){
for(j=1; j<=n; j++){
c[m][n] = z[i][j] + x[i][j]; //Proses Penjumlahan Matriks
printf("%d", c[m][n]);
printf(" "); }
printf("\n");
}

}
else { printf("error");}
return 0;
}

0 Response to "CONTOH MATRIKS"

Posting Komentar

asalammu'alaykum.wr.wb

powered by Blogger | WordPress by Newwpthemes | Converted by BloggerTheme