penjumlahan matrik

Januari 16, 2009

#include
#include
void main()
{
int baris, kolom;
int i, j;
int A[25][25];
int B[25][25];
int X[25][25];
cout<<" TUGAS PENJUMLAHAN MATRIK"<<endl;
cout<<endl;
cout<<"NAMA : DEWI MARTINI"<<endl;
cout<<"NIM : 0708002010061"<<endl;
cout<<"PRODI : D3-INSKOM"<<endl;
cout<<endl;
/******* Masukkan ordo *******/
printf("masukkan ordo baris = ");
scanf("%i",&baris);
printf("masukkan ordo kolom = ");
scanf("%i",&kolom);
/******* Masukkan matriks A *******/
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
{ printf("input data matrik A[%i][%i] : ",i+1,j+1);
scanf("%i",&A[i][j]);
}
}
/******** Masukkan matriks B ********/
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
{ printf("input data matrik B[%i][%i] : ",i+1,j+1);
scanf("%i",&B[i][j]);
}
}
/******** Proses penjumlahan matriks A dan B ********/
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
{ X[i][j]=A[i][j]+B[i][j];
}
}
/******** Cetak isi matriks A ********/
printf("\n matrik A\n");
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
printf("%6i",A[i][j]);
printf("\n");
}
printf("\n");
/******** Cetak isi matriks B *******/
printf("\n matrik B\n");
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
printf("%6i",B[i][j]);printf("\n");
}
printf("\n");
/******** Cetak hasil penjumlahan matriks A dan B *******/
printf("\n matrik penjumlahan A+B\n");
for(i=0;i<baris;i++)
{ for(j=0;j<kolom;j++)
printf("%6i",X[i][j]);printf("\n");
}
printf("\n\n");
}
penjumlahan-matrik1

Hello world!

Januari 16, 2009

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!