Introduction
In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..
class AverageMarks { public static void main(String arg[]) { int n=5,avg=0; int arr[]=new int[n]; arr[0]=80; arr[1]=70; arr[2]=60; arr[3]=50; arr[4]=40; for(int i=0;i<n;i++) avg = avg+arr[i]; System.out.println("average of ("+arr[0]+","+arr[1]+","+arr[2]+","+arr[3]+","+arr[4]+") is = "+ avg/n); } }