Coders Packet


By Alankrita Singh

This code written in C++ calculates the GPA on taking into account the grade and credit for all the courses entered by the user.

  • The double variables S, A, B, C, D, E stand for –

S- 100 % -> 10.

A-90%-> 9

B-80%-> 8

C-70%-> 7

D-60%-> 6

E-50%-> 5

F-40% or less-> 0

  • Integer variable “n” is used to store the number of subjects entered by the user.
  • Char variable “grade” is used to store grade of a particular subject.
  • Double variable “credit” stores the credit of the course entered.
  • total_credit stores the sum of the credits of all the subjects.
  • cal_credit calculates the marks by multiplying the credit of the course to the grade received for the subject.
  • total_cal_credit stores the sum of all the marks calculated by cal_credit in each loop.
  • gpa” calculates the gpa by  dividing the total marks (total_cal_credit) by the total credits (total_credits).

Download Complete Code


No comments yet