CJCoding With Joseph
15free / daySign inCreate account

Grade to GPA

Read a letter grade character (A, B, C, D, or F) with scanf and print the matching GPA to one decimal place using %.1f, with no trailing newline:

A -> 4.0, B -> 3.0, C -> 2.0, D -> 1.0, F -> 0.0.

For input A the output is 4.0; for C it is 2.0; for F it is 0.0.

Expected Output:

4.0

= newline. No newline after the last line.

Hints4 available
Topics:
If Statements
📥 Auto-Input:
A\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.