Computer Science, asked by DarkAgent131, 3 months ago

Please Answer To This Question Correctly-:
In an examination, you have appeared for three subjects i.e. Physics, Chemistry, and Biology. Write a program in Java to calculate the average mark obtained and finally display the marks in the rounded-off form.
Take Physics, Chemistry, Biology marks as inputs.

Answers

Answered by kamalrajatjoshi94
2

Answer:

import java.util.*;

public class Marks

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

int a,b,c,rf=0;

double avg=0.0;

String name;

System.out.println("Enter the name of the student");

name=in.next();

System.out.println("Enter the marks of physics, chemistry and biology");

a=in.nextInt();

b=in.nextInt();

c=in.nextInt();

avg=(a+b+c)/3;

rf=Math.round(avg);

System.out.println("Name:"+name);

System.out.println("The average marks obtained="+avg);

System.out.println("The average marks obtained in rounded form by the student="+rf);

}

}

Output

Enter the name

Sunil Rawat

Enter the marks of physics, chemistry and biology

90

94

92

Name:Sunil Rawat

The average marks obtained=92.0

The average marks obtained in rounded form by the student=92

Similar questions