import java.util.*;
class Student
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int p,c,b,total;
double avg;
System.out.println("Enter the marks of student");
System.out.println("Physics Marks-");
p=sc.nextInt();
System.out.println("Chemistry Marks-");
c=sc.nextInt();
System.out.println("Biology Marks-");
b=sc.nextInt();
total=p+c+b;
avg=total/3;
System.out.println("Total Marks="+total);
System.out.println("Average Marks="+avg);
}
}
Output-
Enter the marks of student
Physics Marks-
85
Chemistry Marks-
88
Biology Marks-
93
Total Marks=266
Average Marks=88.0
class Student
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int p,c,b,total;
double avg;
System.out.println("Enter the marks of student");
System.out.println("Physics Marks-");
p=sc.nextInt();
System.out.println("Chemistry Marks-");
c=sc.nextInt();
System.out.println("Biology Marks-");
b=sc.nextInt();
total=p+c+b;
avg=total/3;
System.out.println("Total Marks="+total);
System.out.println("Average Marks="+avg);
}
}
Output-
Enter the marks of student
Physics Marks-
85
Chemistry Marks-
88
Biology Marks-
93
Total Marks=266
Average Marks=88.0