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 = (Total Scored Marks / Total Number of Subjects) * 100.
Percentage of Marks Formula
Percentage of Marks = (Total Scored Marks / Total Number of Subjects) * 100.
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.
Similar to Percentage of Marks
- C Program To Find Area And Circumference Of Circle
- C Program To Print ASCII Value Of Character
- C Program To Find Area Of Triangle
- C Program to Convert a person's name into Abbreviated
- C Program For Calculate A Simple Interest
- C Program To Find Greater No. Among given Three Number
- C Program For Find The Gross Salary Of An Employee
- C Program For Calculate Percentage Of 5 Subjects
- C Program For Converting Temperature Celsius Into Fahrenheit
- C Program To Display Size Of Different Datatype
0 Comments: