import java.util.Scanner;
public class UlangWhile4
{
public static void main(String args[])
{
Scanner masuk = new Scanner (System.in);
int i=1;
float n, jum, x, rata;
System.out.print("Banyaknya data:");
n=masuk.nextFloat();
jum=0;
while (i<=n){
System.out.print("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