Computer Science, asked by granitebala, 8 months ago

write a program in Java to accept 5 subject marks and print its average and grade.

Answers

Answered by beherasujata83
2

Answer:

pls mark me as a brainlist

Explanation:

print("Average of (");

for(i=0;i<n-1;i++) {

System. out. print(a[i]+","); }

System. out. println(a[i]+") ="+avg/n); }

Answered by anvitanu
3

import java.util.*;

class marks

{

public static void main (String args[])

{

Scanner in=new Scanner (System.in);

int m1,m2,m3,m4,m5,total=0;

double avg=0.0;

System.out.println("Enter marks for five subjects out of 100");

m1=in.nextInt();

m2=in.nextInt();

m3=in.nextInt();

m4=in.nextInt();

m5=in.nextInt();

total=m1+m2+m3+m4+m5;

avg=total/5;

avg=avg/5*100;.

//Dividing avg by 5 again and calculating the percent

if(avg>=80)

System.out.println("Grade A");

else if(avg>=60&&avg<80)

System.out.println("Grade B");

else if(avg<60)

System.out.println("Grade C");

}

}

Similar questions