Jumat, 06 Mei 2016

kasus 6.2 (bab 7)

#include <iostream>
#include <conio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
void nilai_maks(int x){
        int a[50],max;
        for(int i=1;i<=x;i++){
            cout<<"masukan nilai : ";
            cin>>a[i];
        }
        for(int i=1;i<=x;i++){
       
        if(a[i]>max){
            max=a[i];
           
        }
    }
cout<<"nilai maks="<<max;

}
int main(int argc, char** argv) {
{
        int batas;
    cout<<"masukan jumlah :";
    cin>>batas;
    nilai_maks(batas);
   

}
    getch ();
}

Tidak ada komentar:

Posting Komentar