Computer Science, asked by DarkAgent131, 4 months ago

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 jeromeseejo73
8

Answer:

import java. util. Scanner;

public class marks

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in) ;

System.out.print("Enter your biology marks: ") ;

double bio= sc.nextDouble() ;

System.out.print("Enter your chemistry marks: ") ;

double chem= sc.nextDouble() ;

System.out.print("Enter your physics marks: ") ;

double phy= sc.nextDouble() ;

double avg =(bio+chem+phy) /3;

double r_avg=Math.round(avg) ;

System.out.println(" Your average marks are: "+avg) ;

System.out.println(" Your rounded average marks are :"+r_avg) ;

}

}

Similar questions