hasil runningnya :
listing program :
class nilai{
public static void main(String Arg[]){
int nilai[];
int i=0;int jum=0; int rata; int ntt; int ntr;
nilai = new int[10];
nilai[0]=50;
nilai[1]=30;
nilai[2]=80;
nilai[3]=90;
nilai[4]=95;
nilai[5]=40;
nilai[6]=80;
nilai[7]=60;
nilai[8]=70;
nilai[9]=80;
System.out.println("No Nilai ");
System.out.println("----------");
ntt= nilai[i];
ntr= nilai[i];
for(i=0; i<=9;i++){
if (ntt<nilai[i]){
ntt= nilai[i];
}
if (ntr>nilai[i]){
ntr= nilai[i];
}
System.out.println(i +" "+ nilai[i]);
jum+=nilai[i];
}
System.out.println("-----------");
rata= jum/i;
System.out.println("Nilai Rata-Rata = " + rata);
System.out.println("Nilai Tertinggi = " + ntt);
System.out.println("Nilai Terendah = " + ntr);
}
}
0 komentar:
Posting Komentar