CJCoding With Joseph

Validate a Range

Read a score. Valid scores are 0 to 100 inclusive. If the score is outside that range, throw new ArgumentOutOfRangeException(nameof(score), "score must be 0-100"). Otherwise print Score: <score>. Catch the exception and print exactly Score out of range. Use top-level statements with try/catch.

Input 80 prints: Score: 80
Input 150 prints: Score out of range

Expected Output:

Score: 80
Topics:
Exceptions
๐Ÿ“ฅ Auto-Input:
80\n
This input is automatically fed to your program's stdin
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.