Program untuk penjumlahan matrik sederhana :
#include<iostream.h>
#include<conio.h>
void main (){
clrscr ();
int a[2][2];
int b[2][2];
int i,j,c;
a[1][1] = 9;
a[1][2] = 6;
a[2][1] = 3;
a[2][2] = 5;
b[1][1] = 1;
b[1][2] = 1;
b[2][1] = 1;
b[2][2] = 1;
for (i=1; i<=2; i++)
{
for (j=1; j<=2; j++)
{
c = a[i][j] + b[i][j];
cout<<" "<<c;
}
cout<<"\n";
}
getch();
}
Tidak ada komentar:
Posting Komentar