Overflow On Byte Cast
mediumQuestion 752Read an integer n and convert it to a byte using checked((byte)n), then print Byte: <b>. A byte holds 0 to 255; in a checked cast, a value outside that range throws an OverflowException. Catch it and print Too large for byte. Use top-level statements.
Input 200 prints: Byte: 200
Input 300 prints: Too large for byte
Expected output
Byte: 200= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Exceptions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.