Program C++ Menentukan Nilai Maksimum Array

#include<iostream>
using namespace std;
main()
{
int nilai[100];
int i,inp,max,min;
cout<<"http://steroscience.blogspot.co.id/2011/12/include-main-int-nilai100-int.html"<<endl;
cout<<" Masukkan Banyak Inputan : "; cin>>inp;
cout<<"\n";
max=-1000;
min=1000;
for(i=0; i<=inp; i++)
    {
    cout<<" Nilai Ke- "<<i<<" : ";
    cin>>nilai[i];
    }

cout<<"\n";
for(i=0; i<=inp; i++)

if(nilai[i]>max)
        max=nilai[i];

cout<<" Nilai Maksimum = "<<max;
cout<<"\n";
return 0;
}

Output:

Subscribe for latest Apps and Games


0 komentar:

Post a Comment