import java.io.*;
public class tugas{
public static void main(String []dana)throws IOException{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String temp;
int jml=0, nilai=0, rata=0;
//input jumlah data
System.out.print("silahkan masukkan nilai anda = ");
temp=br.readLine();
try{
jml=Integer.parseInt(temp);
}
catch(NumberFormatException nfe){
System.out.println("anda memasukkan nilai yang salah");
System.exit(1);
}
System.out.println("--------------------------");
System.out.println();
//input nilai
for(int i=0;i<jml;i++){
System.out.print("masukan nilai selanjutnya"+(i+1)+" : ");
temp=br.readLine();
try{
nilai=Integer.parseInt(temp);
}
catch(NumberFormatException nfe){
System.out.println("anda memasukkan nilai yang salah");
System.exit(1);
}
if(nilai>100){
System.out.println("nilai anda lebih");
System.exit(1);
}
System.out.println("nilai ke-"+(i+1)+" = "+nilai);
rata=rata+nilai;
}
System.out.println();
//output jumlah nilai, dan rata, serta nilai dalam huruf
System.out.println("jumlah nilai = : "+rata);
rata=rata/jml;
System.out.println("rata nilai = : "+rata);
if (rata >= 90){
System.out.println("nilai anda A");
}
else if (rata >= 70){
System.out.println("nilai anda B");
}
else if (rata >= 60){
System.out.println("nilai anda C");
}
else if (rata >= 50){
System.out.println("Nilai anda D");
}
else {
System.out.println("Nilai anda E");
}