Sabtu, 21 Oktober 2017

[STRUKTUR DATA] : Program Array 2 Dimensi Nilai Terkecil

#include <stdio.h>

int main(){
    int n,t,kcl;
    int baris, kolom;

        printf("\t ===== Program Array =====\n\n");
        printf("\t Masukkan Baris   : "); scanf("%d", &baris);
        printf("\t Masukkan Kolom   : "); scanf("%d", &kolom);

        printf("\t ==============================\n");

    int f[baris][kolom];
    for(n=0;n<baris;n++){
        for(t=0;t<kolom;t++){
            printf("\t Baris (%d) Kolom (%d)  : ",n+1,t+1); scanf("%d", &f[n][t]);
        }
            }

        printf("\t ==============================\n");

    for(n=0;n<baris;n++){
        for(t=0;t<kolom;t++){
            printf("\t %d", f[n][t]);
        }
            }

        printf("\n");

        kcl=100;
    for(n=0;n<baris;n++){
        for(t=0;t<kolom;t++){
            if(f[n][t]<kcl){
                kcl=f[n][t];}
        }
            }
        printf("\t ==============================\n");
        printf("\t Nilai Terkecil Adalah   : %d",kcl);
        }



Share:

0 komentar:

Posting Komentar


BTemplates.com

About Me

Diberdayakan oleh Blogger.

Followers