Computer Science, asked by iamradiatorgaming, 8 hours ago

Write a program to find total % of 5 subjects . Input marks of 5 subjects using scanner class​

Answers

Answered by I40595567
0

Answer:

/ Java program to enter the marks of five subjects and calculate the total, average, and percentage import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter the marks of five subjects::\n"); float p = in.nextFloat(); float c = in.nextFloat(); float m = in.nextFloat(); float e = in.nextFloat(); float h = in.nextFloat(); float total; float average; float percentage; // p, c, m, e, and h are the five subjects // p = physics // c = chemistry // m = math // e = english // h = history // Calculate total, average and percentage total = p + c + m + e + h; average = (float)(total / 5.0); percentage = (float)((total / 500.0) * 100); // Output System.out.println("\nThe Total marks = " + total + "/500.0"); System.out.println("\nThe Average marks = " + average); System.out.println("\nThe Percentage = " + percentage + "%"); } }

Explanation:

from myself

Similar questions