157k views
3 votes
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
...?

User Andrekos
by
7.8k points

1 Answer

2 votes
The easy way to do it is to let an array accept all the inputs and add all the inputs together and divide the sum by how many the input was.

Example : five + five + five + five + three + two = 25
Now divide twenty five : twenty five / six = 4.1

Letter A is the closest answer.
User Kevin Vasko
by
7.3k points