Recap Challenge
Part of the Fundamentals section of Coddy's C journey — lesson 30 of 63.
Challenge
EasyCreate a program that analyzes a student's numerical score and provides feedback using multiple control flow techniques.
Your program should implement the following logic:
- If the score is invalid (less than 0 or greater than 100), print "Invalid score" and exit.
- Use a switch statement to print the letter grade:
- 90-100: "A"
- 80-89: "B"
- 70-79: "C"
- 60-69: "D"
- 0-59: “F”
- Finally, use the ternary operator to print whether the student passed or failed (passing is 60 or above).
Try it yourself
#include <stdio.h>
int main() {
int score;
scanf("%d", &score);
// Don't change above this line
// Write your code here
return 0;
}All lessons in Fundamentals
4Control Flow
If StatementIf - ElseElse-IfSwitch CaseTernary Conditional OperatorRecap ChallengeNested If - Else3Operators
Arithmetic OperatorsModulo OperatorIncrement/DecrementAssignment OperatorsRelational OperatorsLogical Operators Part 1Logical Operators Part 2Logical Operators Part 3Recap Challenge