Java Program for Average value of Array elements
package coreJava; import java.util.Scanner; public class Average { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the size of array"); int size=sc.nextInt(); int arr[]=new int[size]; System.out.println("Now Enter "+size+" elements"); int sum=0; for(int i=0;i<size;i++) { arr[i]=sc.nextInt(); sum+=arr[i]; } System.out.println("Average of all the elements is: "+(sum/size)); sc.close(); } }