Tech Study

Java program to calculate average marks

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);
 
                    }
}

Result

Java program to calculate average marks
Java program to calculate average marks

TaggedJava program to calculate average marks

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more