#include<iostream>
using namespace std;
int main(){
int A[10]={10,3,7,5,6,12,27,13,14,15};
int n=0;
int besar1, besar2;
int total=0;
besar1=0;
besar2=0;
float rata;
for(n=0; n<10; n++){
if(A [n]> besar1)
besar1=A[n];
total+=A[n];}
for (n=0; n<10; n++){
if (A[n]>besar2, A[n]< besar1)
besar2=A[n];}
rata=total/n;
cout<<endl<<endl;
cout<<"Nilai Besar 1="<<besar1<<endl;
cout<<"Nilai Besar 2="<<besar2<<endl;
cout<<"Total Aray ="<<total<<endl;
cout<<"Rata-rata ="<<rata<<endl;
return 0;
}
using namespace std;
int main(){
int A[10]={10,3,7,5,6,12,27,13,14,15};
int n=0;
int besar1, besar2;
int total=0;
besar1=0;
besar2=0;
float rata;
for(n=0; n<10; n++){
if(A [n]> besar1)
besar1=A[n];
total+=A[n];}
for (n=0; n<10; n++){
if (A[n]>besar2, A[n]< besar1)
besar2=A[n];}
rata=total/n;
cout<<endl<<endl;
cout<<"Nilai Besar 1="<<besar1<<endl;
cout<<"Nilai Besar 2="<<besar2<<endl;
cout<<"Total Aray ="<<total<<endl;
cout<<"Rata-rata ="<<rata<<endl;
return 0;
}
Tidak ada komentar:
Posting Komentar