Computer Science, asked by singhanvit9, 8 months ago

5 points
Write a program in JAVA to
enter total marks of a student
out of 500. Calculate the
percentage. Print the Total
marks and percentage in
separate lines.(Also write the
messages)​

Answers

Answered by gouravkuamrverma2
0

Answer:

Basic version with standard values. Here we took Int n=5; it’s all up to you. And also check output screen.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

class AverageMarks

{

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 :

1

average of (10,20,30,40,50) is =30

Java Program Calculate Average Marks Using Arrays

Java code for obtaining an average of marks taking inputs through Scanner class. Here it is: #Inputs Through Scanner

Explanation:

mark me as billaint

Similar questions