← Back to Exceptions
Question 681
Overflow When Parsing a Byte
Overflow When Parsing a Byte
Read a line and parse it into abyte(which holds0to255) usingbyte.Parse, then printByte: <b>. A value larger than255throws anOverflowException— catch it and print exactlyToo big for a byte. Use top-level statements withtry/catch. Input200prints: Byte: 200 Input300prints: Too big for a byte
Expected Output:
Byte: 200
Topics:
Exceptions
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.