Kehidupan Dunia Maya

Just another WordPress.com weblog

Tugas Komputasi Numerik

Tugas Komputasi Numerik

#include
#include
void main()
{
int baris, kolom;
int i, j;
int A[25][25];
int B[25][25];
int X[25][25];
cout<<“Nama : Eriadi”<<endl;
cout<<“NIM : 0708002010009″<<endl;
cout<<“Prodi : D3-Inskom”<<endl;
cout<<“===============================”<<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”);
}

Iklan

Januari 15, 2009 - Posted by | Uncategorized

Belum ada komentar.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: