Q:

Java program to calculate average marks

belongs to collection: Simple Formula Based Java Programs

0

Java program to calculate average marks

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Java program to check vowel or consonant... >>
<< Java program to find surface area area of cube...