Sample Programs in java

Java Example Program to find the Average of Marks

[java]
/**
*@author:Candidjava.com
*@Discription: collact the student marks and find the average of marks
*/
public class Avg {
public static void main(String[] args) {
int n = 5;
int marks[] = { 50, 62, 75, 63, 92 };// student marks
int avg;
avg = (50 + 62 + 75 + 63 + 92) / n;// find the Average
System.out.println("avg:" + avg);// display the value of Average
}
}

[/java]

Table of Contents

Output:

Avg:68