belongs to collection: Simple Formula Based Java Programs
Java program to calculate average marks
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); } }
Result:
average of (80,70,60,50,40) is = 60
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
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..
Result:
average of (80,70,60,50,40) is = 60
need an explanation for this answer? contact us directly to get an explanation for this answer