CJCoding With Joseph

Validate Percentage Range

Read an integer percent. If it is < 0 or > 100, explicitly throw new ArgumentOutOfRangeException("percent", "must be 0-100"); otherwise print Valid: <p>%. Catch the ArgumentOutOfRangeException and print Invalid percentage. Use top-level statements.

Input 75 prints: Valid: 75%
Input 150 prints: Invalid percentage

Expected Output:

Valid: 75%
Topics:
Exceptions
๐Ÿ“ฅ Auto-Input:
75\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.