Computer Science, asked by aloklatamanna350, 5 months ago


Write a program in Java using parameterised input to take five subjects marks and print the sum and
percentage of the marks. Percentage is take out from full mark 500. ​

Answers

Answered by srijashreedubey
1

Answer:

public class Total_of_5_subjects {

private static Scanner sc;

public static void main(String[] args)  

{

 int totalSubjects, i;

    float Marks, total = 0, Percentage, Average;

 sc = new Scanner(System.in);

 

 System.out.print(" Please Enter the Total Number of Subjects : ");

 totalSubjects = sc.nextInt();

 

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

 for(i = 0; i < totalSubjects; i++)

 {

  Marks = sc.nextInt();

  total = total + Marks;

 }

 

 Average = total / totalSubjects;

    Percentage = (total / (totalSubjects * 100)) * 100;

     

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

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

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

}

}

Answered by Abhinab08
2

Answer:

plz appreciate if it helps u¯\_ʘ‿ʘ_/¯

Explanation:

// Java program to find Total Average and percentage of Five Subjects by Abhinab08

Java program to find Total Average and percentage of Five Subjects by Abhinab08import 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);

}

}

thanxx

Similar questions