import java.util.Scanner;
public class Modul7
{
public static void main(String args[])
{
Scanner masuk=new Scanner(System.in);
int i=1;
float n, jum, x, rata;
System.out.println("Banyaknya data: ");
n = masuk.nextFloat();
jum=0;
while (i<=n) {
System.out.println("Data ke-"+i+": ");
x=masuk.nextFloat();
jum += x;
i++;
}
rata = jum / n;
System.out.println("Rata-rata: "+rata);
System.out.println("Jumlah: "+jum);
}
}
Tidak ada komentar:
Posting Komentar