Java program to calculate average marks

In this post, we will see how to calculate average marks in java.


Problem

Given the marks of n subject as array, calculate average and percentage of Student.

Example:
arr[] = {92,67,87,98,89,74};
Average Marks = 84.5
Percentage = 84.5%

Solution

  • Formula for average = sum of marks /total number of subjects
  • Percentage = (sum of marks/total marks) * 100

Output:

Average Marks = 84.5
========================
Percentage = 84.5%

Leave a Reply

Your email address will not be published. Required fields are marked *