19/03/2023

How to Calculate Percentage of Marks of 6 Subjects | 5 Steps

How to Calculate Percentage of Marks of 6 Subjects or how to calculate percentage of marks of 12th class or how to calculate percentage of marks of 10th class or how to find percentage of marks of all subjects. All subjects mean 5 Subjects or 6 Subjects. First, we will ask the user for the total number of subjects after that we will enter the marks of all those subjects. Now we will Calculate Percentage of Marks and print Percentage of Marks, with the percentage of marks formula.

How to Calculate Percentage of Marks of 6 Subjects

How to Calculate Percentage of Marks of 6 Subjects in Just 5 Steps


Here, I am taking 6 subjects as an example. The subjects are Hindi, English, Sanskrit, Math, Science and Social Science. Below are the 5 Steps to Calculate the Percentage of Marks.

  • First, ask the user to enter all subjects.
  • Store the marks of All subjects in an array.
  • Add the marks of Subjects which already been entered by the user.
  • Now apply the Percentage of Marks formula.
  • Print the Percentage of Marks calculated by the formula. 

After following these 5 steps we can Calculate the Percentage of Marks with Different Weights.

Percentage of Marks Formula


Percentage of Marks = (Total Scored Marks / Total Number of Subjects) * 100.

Percentage of Marks Formula


C Program to Calculate Percentage of Marks of 5 Subjects


#include <stdio.h>

int main()
{
	/*C Program to Calculate Percentage of Marks of 5 Subjects*/

	int sub, marks, n, i, sum = 0, tmp = 0, arr[10], Percentage;

	printf("\nEnter the 5 Subjects: \n");
	scanf("%d", &n);

	tmp = n * 100;

	printf("\nEnter The Marks: \n");
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}

	for (i = 0; i < n; i++)
	{
		sum = sum + arr[i];
	}

	Percentage = (sum *100) / tmp;

	printf("\nPercentage of Marks: %d\n", Percentage);

	return (0);

}

Calculate Percentage of Marks of 6 Subjects in C++


#include <iostream>
using namespace std;
int main()
{
	/*How to Calculate Percentage of Marks of 6 Subjects*/

	int i, subjects;
	float marks = 0, percentage;

	cout << "\nEnter Total Number of Subjects: \n";
	cin >> subjects;

	int arr[subjects];

	cout << "\nEnter The Marks of All the Subjects: \n";
	for (i = 0; i < subjects; i++)
	{
		cin >> arr[i];
	}

	for (i = 0; i < subjects; i++)
	{
		marks = marks + arr[i];
	}

	percentage = marks / subjects;

	cout << "\nPercentage of Marks: " << percentage << " % " << endl;

	return (0);
}

Calculate Percentage of Marks of 12th Class in Java


import java.util.Scanner;

/* Calculate Percentage of Marks of 12th Class in Java of 5 Subjects */

public class percentage {

	public static void main(String args[]) {
		int marks[] = new int[5];
		int i;
		float percentage_of_marks, sum = 0;

		Scanner sc = new Scanner(System.in);

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

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

		}

		percentage_of_marks = (sum / 5);

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

		System.out.println("Gross Salary Of Employee: " + percentage_of_marks);
	}
}

Calculate the Percentage of Marks of 6 Subjects of the 12th Class. These Subjects are Hindi, English, Sanskrit, Math, Science and Social Science.

How to Calculate the Percentage of Marks of 6 Subjects of the 12th Class. These Subjects are Hindi, English, Sanskrit, Math, Science and Social Science.

Similar to Percentage of Marks


Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: