#include <stdio.h>
#include <stdio.h>
using namespace std;
int main()
{
int x,y,brs,klm,hsl;
int mtk[brs][hsl];
printf("=====================================\n");
printf("\tMENENTUKAN NILAI TERKECIL DARI SEBUAH MATRIKS\n");
printf("=====================================\n\n");
printf("Masukkan Baris = ");scanf("%d",&brs);
printf("Masukkan Kolom = ");scanf("%d",&klm);
printf("\n\n");
printf (" Masukkan Matrix \n\n");
for (x=0;x<brs;x++){
for (y=0;y<klm;y++){
printf ("\n Baris [ %d ],Kolom [ %d ] : ",x+1,y+1);
scanf("%d",&mtk[x][y]);
}}
printf("--------------------------------------\n");
printf("\n");
for (x=0;x<brs;x++){
for (y=0;y<klm;y++){
printf("\t%d",mtk[x][y]);
}
printf("\n");
}
int mn=0;
for (x=0;x>brs;x++){
for (y=0;y>klm;y++){
if(mtk[x][y]>mn){
mn=mtk[x][y];
}
}
printf("\n");
}
printf("Nilai Terkecilnya adalah : %d", mn);
}
int main()
{
int x,y,brs,klm,hsl;
int mtk[brs][hsl];
printf("=====================================\n");
printf("\tMENENTUKAN NILAI TERKECIL DARI SEBUAH MATRIKS\n");
printf("=====================================\n\n");
printf("Masukkan Baris = ");scanf("%d",&brs);
printf("Masukkan Kolom = ");scanf("%d",&klm);
printf("\n\n");
printf (" Masukkan Matrix \n\n");
for (x=0;x<brs;x++){
for (y=0;y<klm;y++){
printf ("\n Baris [ %d ],Kolom [ %d ] : ",x+1,y+1);
scanf("%d",&mtk[x][y]);
}}
printf("--------------------------------------\n");
printf("\n");
for (x=0;x<brs;x++){
for (y=0;y<klm;y++){
printf("\t%d",mtk[x][y]);
}
printf("\n");
}
int mn=0;
for (x=0;x>brs;x++){
for (y=0;y>klm;y++){
if(mtk[x][y]>mn){
mn=mtk[x][y];
}
}
printf("\n");
}
printf("Nilai Terkecilnya adalah : %d", mn);
}
Algoritma Array 2 Dimensi
(Menampilkan nilai Terbesar dari kumpulan element array yang telah di inputkan)
Deklarasi ;
Int x, int y, int brs, int klm, int hsl
Int mtk[brs][klm]
Input banyaknya baris dan kolom ;
masukkan(baris)
masukkan(kolom)
Input baris dan kolom ;
for(x=0;x<brs;x++)
for(y=0;y<klm;y++)
write(mtk[a][b]);
Output baris dan kolom ;
for(x=0;x<brs;x++)
for(y=0;y<klm;y++)
write(mtk[a][b])
Rumus menentukan nilai maksimal ;
for(x=0;x<brs;x++)
for(y=0;y<klm;y++)
if(mtk[x][y]>mx)
mx=mtk[x][y]
Total seluruh nilai/angka yang diinput ;
write(hsl);
Komentar
Posting Komentar