in an examination you have appeared for the test subject that is physics chemistry and biology write a program in Java to calculate the average marks obtained and finally display the marks in rounded off form take physics chemistry biology marks as input show the vaiable desciption.
Answers
Answered by
1
PROGRAM:
{
public static void main(String arg[])
{
int n=5,avg=0;
int a[]=new int[n];
a[0]=10;
a[1]=20;
a[2]=30;
a[3]=40;
a[4]=50;
for(int i=0;i<n;i++)
avg=avg+a[i];
System.out.println("average of ("+a[0]+","+a[1]+","+a[2]+","+a[3]+","+a[4]+") is ="+ avg/n);
}
}
OUTPUT:
average of (10,20,30,40,50) is =30
Similar questions
Chemistry,
4 months ago
Music,
4 months ago
Science,
8 months ago
Social Sciences,
8 months ago
Business Studies,
11 months ago
Social Sciences,
11 months ago