2. Write a program to calculate CGPA of a student. The program should be able to get input from the user of the grade for each course. Use data in Table 1 and Table 2 as to calculate the CGPA. Course Credit Hour Mathematics 5 Physics 5 Chemistry 5 Computer 5 BEL 3 CTU 2 Table 1: Course Information Grade Point A 4.00 B 3.00 C 2.00 Table 2: Grade Information
A simple solution. It might seem lengthy but will help you to understand the program clearly. Also, it's not a proper program but this might help. You must be used to write the code yourself. Declare variable names for subjects..like m for maths, phy for physics...etc. to store grades and gpmath, gpphy to store points. Take input maths,physics,computer....other subject's grades. if entered grade for maths ='a' or 'A' assign 4 to gpmath.....and so on for other grades. CGPA= (credit hours math * gpmath + ............other subjects)/total credit hours
Join our real-time social learning platform and learn together with your friends!