Computer Science, asked by indraneel14, 2 months ago

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.​

Answers

Answered by rownakmukherjee
4

Answer:

Explanation:

import java.util.Scanner;

public class Totalof5subjects1 {

private static Scanner sc;

public static void main(String[] args)  

{

 int english, chemistry, computers, physics, maths;  

    float total, Percentage, Average;

 sc = new Scanner(System.in);

 

 System.out.print(" Please Enter the Five Subjects Marks : ");

 english = sc.nextInt();  

 chemistry = sc.nextInt();  

 computers = sc.nextInt();  

 physics = sc.nextInt();  

 maths = sc.nextInt();  

 

 total = english + chemistry + computers + physics + maths;

 Average = total / 5;

    Percentage = (total / 500) * 100;

     

    System.out.println(" Total Marks =  " + total);

    System.out.println(" Average Marks =  " + Average);

    System.out.println(" Marks Percentage =  " + Percentage);

}

}

Similar questions