Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. Display the name of the student, total and average. DO NOT USE ANY INPUT METHOD
Answers
Answered by
1
public class marks
{
public static void main(String args[])
{
int a,b,c,d,e; //to store marks for 5 subjects
int total; //to store total
double avg; //to store average
a=67;
b=78;
c=89;
d=91;
e=83;
total=a+b+c+d+e;
avg = total/5;
System.out.println(“Rajiv Total Marks = “+total+” and Average Marks = “+avg);
}
}
{
public static void main(String args[])
{
int a,b,c,d,e; //to store marks for 5 subjects
int total; //to store total
double avg; //to store average
a=67;
b=78;
c=89;
d=91;
e=83;
total=a+b+c+d+e;
avg = total/5;
System.out.println(“Rajiv Total Marks = “+total+” and Average Marks = “+avg);
}
}
Similar questions