ARRAY 2 DIMENSI

#include
#include
/**
NAMA : Marcell Rayhan
NIM : A11.2018.10945
MODIFIKASI : Array 2 dimensi
**/

///KAMUS GLOBAL
int array1[5][5] =
{
{8,3,4,9,6},
{1,5,6,8,3},
{4,6,7,9,3},
{2,5,4,1,7},
{9,4,2,6,9}
};
int array2[5][5] =
{
{3,2,1,4,6},
{6,7,8,9,4},
{1,3,5,2,7},
{7,2,3,1,6},
{8,6,5,4,3}
};
int kolom,baris;
int main()
{
///ARRAY PERTAMA
printf(“ARRAY PERTAMA : \n”);
kolom=0;
while(kolom<5)
{
baris=0;
while(baris<5)
{
printf("%d",array1[kolom][baris]);
baris=baris+1;
printf("\t");
}
printf("\n");
kolom=kolom+1;
}

printf("\n");
printf("\n");

///ARRAY KEDUA
printf("ARRAY KEDUA : \n");
kolom=0;
while(kolom<5)
{
baris=0;
while(baris<5)
{
printf("%d",array2[kolom][baris]);
baris=baris+1;
printf("\t");
}
printf("\n");
kolom=kolom+1;
}

puts("");
puts("");
puts("");
printf("APAKAH MATRIKS A SAMA DENGAN MATRIKS B ?\n");
if( array1 == array2 )
{
printf("MATRIKS A SAMA DENGAN MATRIKS B");
}
else
{
printf("MATRIKS A TIDAK SAMA DENGAN MATRIKS B");
}
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *