Computer Science, asked by kumarianamika23, 8 months ago

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 BedantaDey06
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