Cgpa : of (GP CH) For All Sem Totalcomplete CH
Cgpa : of (GP CH) For All Sem Totalcomplete CH
The code is all about finding the CGPA and GPA of students using C programming.
Grading in education is the process of applying standardized measurements of varying levels
of achievement in a course. Grades can be assigned as letters, as a range, as a percentage, or
as a number out of a possible total.
CGPA means Cumulative Grade Point Average. Cumulative Grade Point Average (CGPA) is
the average of Grade Points obtained for all semesters and courses completed up to a given
academic term, whereas the Grade Point Average (GPA) may only refer to one term.
In order to find the CGPA and GPA of students the code initially takes the input of total
number of semester (ns). If ns is equal to zero then it will calculate the CGPA of student using
CGPA=
∑ of ( GP∗CH ) for all sem
Total complete CH
Otherwise it will decrement the value of ns by one and thereafter it will again take the input of
total number of courses (nc). If nc is equal to zero then it will calculate the GPA of student
using
GPA=
∑ of ( GP∗CH ) for sem
Total sem credit
Otherwise it will decrement the value of nc by one and thereafter it will take the input of grade
and credit.
Methodology
In this project, initially we made the sequential ideas in rough format and arrange all the
associated element. After clear understanding calculation of CGPA and GPA for any
semester and their related number of courses. Thereafter we did the hardest section for this
code that is logic computation and arrange all the logical statement in sequential format using
c language and the best part for our project was that we did all the work within specified time
with proper management
Flow chart:
Explanation of approach
Pseudo code:
Start
Enter number of completed semesters
Enter number of course of each semester
Enter course grade and credit for each course
Calculate GPA for a single semester
GPA=
∑ of ( GP∗CH ) for sem
Total sem credit
If all semester completed, then goto next step otherwise goto step 3
Calculate CGPA
CGPA=
∑ of ( GP∗CH ) for all sem
Total complete CH
If CGPA > 2.0
o Then print “good”
Stop
C language code:
#include <stdio.h>
int main(void) {
while(1){
int sems,courses,i;
float totalGradePoints = 0.0;
float totalCreditHours = 0.0;
printf("Number of semesters completed? "); // asking the number of semesters
scanf("%d",&sems); // taking input from the user
for(i = 0; i<sems; i++){ // now iterating till the sems
printf("Enter the number of courses taken in each semester? ");
scanf("%d",&courses); //and taking the courses
int j;
for(j=0; j< courses; j++){ // then for each course taking the grade and credit
printf("Enter grade in course and the credit hours for that code in that course. ");
float temp1,temp2;
scanf("%f",&temp1);
scanf("%f",&temp2);
totalGradePoints += temp1*temp2; // and adding it to toal grade
totalCreditHours += temp2; // and total credit
}
}
float gpa = totalGradePoints / totalCreditHours; // then dividing the total grade with total
points
printf("Your gpa for all semesters is: %.2f\n",gpa);
if(gpa>=4){ // using if else to decide the grade
printf("Your Grage is A.\n");
}
else if(gpa>=3){
printf("Your Grage is B.\n");
}
else if(gpa>=2){
printf("Your Grage is C.\n");
}
else if(gpa>=1){
printf("Your Grage is D.\n");
}
else if(gpa>=0){
printf("Your Grage is F.\n");
}
printf("print 1 to continue and 0 to stop. "); // asking the user if he wants to calculate gpa for
int x; // another student
scanf("%d",&x);
if(x == 0){
break;
}
}
return 0;
}
Conclusion
After doing this project, we understood the basic mechanism of c programming and
demonstrated the discrete algorithm in a code format using C language statement. Even with
the basic knowledge of programming we also performed data processing task and showed the
great extent of programming.