Computer Science, asked by bindushree1, 6 hours ago

write a Java program to accept four subjects marks of a student and print the total and average
pls answer fast it's urgent

Don't spam ❌​

Answers

Answered by Kalihacker
1

Answer:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Integer sum=0;

String out1,out2;

Scanner read=new Scanner(System.in);

System.out.print("Emter the mark of first subject: ");

Integer mrk1=read.nextInt();

sum=sum+mrk1;

System.out.print("Enter the mark of second Subject: ");

Integer mrk2=read.nextInt();

sum=sum+mrk2;

System.out.print("Enter the mark of third subject: ");

Integer mrk3=read.nextInt();

sum=sum+mrk3;

System.out.print("Enter the mark of fourth subject: ");

Integer mrk4=read.nextInt();

sum=sum+mrk4;

out1=String.format("The total is %s",sum);

System.out.println(out1);

double avg=((double) sum)/4;

out2=String.format("The average is %s",avg);

System.out.println(out2);

}

}

PLEASE MARK AS BRAINLIEST

Similar questions