Posted by Belajar Pemrograman
Program Bahasa C Array 2 Dimensi Program Matriks
#include<stdio.h>
int main (){
//belprog.blogspot.com
int f,a,baris,kolom;
printf("\t\t\t\t -------------------------\n");
printf("\t\t\t\t |Program Array 2 Dimensi|\n");
printf("\t\t\t\t -------------------------\n\n");
printf ("Masukkan Banyak Baris : ");
scanf ("%d",&baris);
printf ("Masukkan Banyak Kolom : ");
scanf ("%d",&kolom);
printf ("\n\n");
int j [baris][kolom];
printf ("Input Masing-Masing Baris dan Kolomnya\n");
printf ("--------------------------------------");
printf ("\n");
for (f=0;f<baris;f++){
for(a=0;a<kolom;a++){
printf ("Baris ke-%d dan Kolom ke-%d: ",f+1,a+1);
scanf ("%d",&j[f][a]);
}
}
printf ("\n\n");
printf("Hasil Matriksnya\n");
printf("----------------");
printf ("\n");
for (f=0;f<baris;f++){
for(a=0;a<kolom;a++){
printf ("%2d ",j[f][a]);
}
printf ("\n");
}
//fajri_jauhari(belprog.blogspot.com)
system("pause");
}