Monday, 19 December 2016

Java Program For Calculate Percentage of 5 Subjects

Problem:- java program for student mark list using an array or simple java program for student details or java program for student mark sheet or java program for student mark list using inheritance or java program calculate student grades or java program for student mark sheet or calculate percentage in java example simple java program for student details or java program calculate student grades or student mark list program in java or mark sheet generation project in java with source code or java program for student mark list using inheritance or java program to find the grade of a student using if else or Java Program For Calculate Total Marks Of 5 Subjects And percentage.

Check This:- HackerRank solution for C++ Domain.

Logic:- First we will ask the user for the total number of the subject after that we will enter marks of all those subjects. Now we will calculate a percentage of marks and print student marks, percentage, and Grade of Student. Percentage formula is given Below. 

Percentage of Marks = (all subject marks sum) / Total Subject *100.

Explanation:- For this problem, I am taking 5 subjects. Now the first user has to enter a number of the subject of a student after that enter all subject marks and store the marks in an array. Now next step to add or find a sum of all subjects marks entered by the user and apply the formula and print the output calculated by the formula given.


System.out.print("Enter The 5 Subject Marks : ");

for(i=0; i<5; i++)
{
marks[i] = sc.nextInt();
sum = sum + marks[i];
}


System.out.print("\nStudent Percentage is = " +per+ "%\n\n");

Example:- Now take an example and check the output step by step. let's take 5 subjects in a semester and we have to calculate percentage out of total number 5 * 100 = 600.

Enter number of subjects: 5

Enter The Marks: 78 65 56 89 90

Percentage of a student: 75.6


See Also:- C++ Program For Calculate Percentage of 5 Subjects

Java Program For Calculate Percentage of 5 Subjects



import java.util.Scanner;
/* Program By Ghanendra Yadav
    Visit http://www.programmingwithbasics.com/
*/
public class percentage
{
    public static void main(String args[])
    {
        int marks[] = new int[5];
        int i;
        float per,sum=0;

        Scanner sc = new Scanner(System.in);
 
        System.out.print("Enter The 5 Subject Marks : ");
        for(i=0; i<5 100="" i="" is=" +per+ " marks="" n="" nstudent="" per="(sum/500)" percentage="" pre="" sc.nextint="" sum="sum" system.out.print="">

See Also:- C Program For Calculate Percentage of 5 Subjects

Output:-

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment