Marks and Menus
Exercises
- Read five subject marks, calculate the percentage, and assign a class: Fail below 35%, Pass from 35% to below 45%, Second Class from 45% to below 60%, First Class from 60% to 70%, and Distinction above 70%. Treat exactly 70% as First Class.
- Find the largest of three numbers using the conditional operator.
- Print the number of days in a month. Reject invalid month numbers; February is treated as 28 days.
Concepts practiced
Conditional operator, range checks, and input validation.
Click here for explanation and solution.