/**
* @(#)dim1.java
* @author Widyawati
* @version 1.00 2013/11/7
*/
import java.util.*;
public class dim1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int[] array= new int[10];
int i,j,jumlah=0;
float rata;
System.out.print("Masukan Jumlah data : ");
i=input.nextInt();
for(j=0;j<i;j++)
{
System.out.print("Data ke-"+(j+1)+" = ");
array[j]=input.nextInt();
jumlah=jumlah+array[j];
}
rata=jumlah/i;
System.out.println("\n\nNilai Element Array");
for(j=0;j<i;j++)
{
System.out.println("Data ke-"+(j+1)+" = "+array[j]);
}
System.out.println("----------------- +");
System.out.println("Jumlah = "+jumlah);
System.out.println("Rata-rata = "+rata);
}
}
Tidak ada komentar:
Posting Komentar
Please Leave Your Comment :)