Initial Basics – Algebra – Problem #17

IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive

Difficulty: medium

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.

Back to Lab Problems
Initial Basics/Algebra/Problem #17

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #17

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.