Initial Basics – Algebra – Problem #17
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
2. Write a program to do the following: a. Read the roll number (integer) of a student and the letter grades (E,A,B,C,D,P, and F) in three subjects, the subject numbers, and the corresponding credits. If a user enters any letter other than the letters corresponding to valid grades, your program should exit after displaying the message "Cannot handle invalid grade!". [Hint: exit from a program can be achieved by writing "return 0" as the body of the if statement checking whether the entered letter corresponds to a valid grade.] Display the Roll number of the student and the subject numbers and the corresponding grades nicely formatted. b. Compute and display the GPA (Grade Point Average). Assume E grade=10points, A grade=9 points, B grade = 8 points, C grade=7 points, D grade=6 points, P grade=5 points, F grade=0 points.