Computer Science, asked by mirajmisba, 4 months ago

Write a program in java to calculate the sum of 5 subject

Answers

Answered by Misscottoncandy6
8

Answer:

  1. import java.util.Scanner;
  2.  
  3. public class MarksCalculator
  4. {
  5.    public static void main(String args[])
  6.    {
  7.        int markArray[] = new int[5];
  8.        int i;
  9.        float sum=0;
  10.        float average, percentage;
  11.        Scanner scan = new Scanner(System.in);
  12.  
  13.        System.out.print("Enter marks for 5 Subjects : ");
  14.        for(i=0; i<5; i++){
  15.            markArray[i] = scan.nextInt();
  16.            sum = sum + markArray[i];
  17.        }
  18.  
  19.        average = sum/5;
  20.        percentage = (sum/500) * 100;
  21.  
  22.        System.out.print("Average Marks = " +average);
  23.  
  24.        System.out.print("\nPercentage = " +percentage+ "%");
  25.    }
  26. }

Explanation:

please mark me as brainliest

Answered by mansurnhm
0

djididjsgsvhskxohchdkdkhsywn Ela

Similar questions