# SGPA calculator

``````

Refresh to reload, To enter score and credit of a subject first enter score then give space and enter credit, then press OK BUTTON

Answer the questions being asked in the pop up . If the pop up does not appear then kindly enable pop up for our website in the top right corner of your device settings.
To enter score and credit of a subject first enter score then give space and enter credit, then press ENTER BUTTON.

function getGP(marks, max_marks = 100) {
let gp = 0;
if (max_marks == 100) {
if (marks >= 91 && marks <= 100) gp = 10;
else if (marks >= 81 && marks <= 90) gp = 9;
else if (marks >= 71 && marks <= 80) gp = 8;
else if (marks >= 61 && marks <= 70) gp = 7;
else if (marks >= 51 && marks <= 60) gp = 6;
else if (marks >= 46 && marks <= 50) gp = 5;
else if (marks >= 40 && marks <= 45) gp = 4;
} else if (max_marks == 50) {
if (marks >= 46 && marks <= 50) gp = 10;
else if (marks >= 41 && marks <= 45) gp = 9;
else if (marks >= 36 && marks <= 40) gp = 8;
else if (marks >= 31 && marks <= 35) gp = 7;
else if (marks >= 26 && marks <= 30) gp = 6;
else if (marks >= 23 && marks <= 25) gp = 5;
else if (marks >= 20 && marks <= 22) gp = 4;
}
return gp;
}

function calculateGPA() {
let num_theory = parseInt(prompt("Enter the number of theory subjects: "));
let theory_marks = [];
let theory_credits = [];
let total_theory_credits = 0;
let total_theory_gp = 0;

for (let i = 0; i < num_theory; i++) {
let input = prompt(`Enter the marks and credits for theory subject \${i+1}:  enter the marks first and then give space then enter the credit of that subject and press enter e.g. 82 4 `);
let [marks, credits] = input.split(" ").map((str) => parseInt(str));
theory_marks.push(marks);
theory_credits.push(credits);
total_theory_credits += credits;
total_theory_gp += getGP(marks) * credits;
}

let max_marks = parseInt(prompt("Does each practical subject have a maximum marks of 100 or 50? (Enter 100 or 50): "));
let num_practical = parseInt(prompt("Enter the number of practical subjects: "));
let practical_marks = [];
let practical_credits = [];
let total_practical_credits = 0;
let total_practical_gp = 0;

for (let i = 0; i < num_practical; i++) {
let input = prompt(`Enter the marks and credits for practical subject \${i+1}:`);
let [marks, credits] = input.split(" ").map((str) => parseInt(str));
practical_marks.push(marks);
practical_credits.push(credits);
total_practical_credits += credits;
total_practical_gp += getGP(marks, max_marks) * credits;
}

let result = (total_theory_gp + total_practical_gp) / (total_theory_credits + total_practical_credits);
}

calculateGPA();

``````

SGPA and CGPA are the most significant components to assess the performance of an individual in an assessment. SGPA and CGPA help analyse aspirants’ growth while giving them room for improvement. SGPA and CGPA are used globally for ranking students based on their performances. India still uses a percentage system to calculate the performances of the students. Although certain institutes have opted for the SGPA and CGPA systems, the number of such institutes is significantly low. There are countless methods to calculate the SGPA and CGPA percentage of the student.

SGPA expands to mean Sessional Grade Point Average or Semester Grade Point Average. This helps calculate a student’s score for the entire term or the session. It calculates the average of all the grade points the student in the given semester has secured. It is the cumulative grade given at the end of each session to the student. This helps to understand your progress and motivates you to work on places that might be your weakest link. Every country has a different way of calculating SGPA. It is essential to keep a tab on your SGPA to leave room for improvement.

The full form of CGPA is Cumulative Grade Point Average. CGPA is a globally used method to measure the comprehensive academic record of a student. It usually consists of grades like A, B, C, D or F. The grade points are the average of the marks obtained for all the semesters. The marks are given after the given academic term. It is sometimes confused with GPA, which is the Grade Point Average that specifies the assessment of only one term.