← Back to Exceptions
Question 766
Print the Exception Type Name
Print the Exception Type Name
Read an integer and printValue: <n>. If parsing fails, catch the exception and print the name of its type usingex.GetType().Name(which prints exactlyFormatExceptionfor bad input). Use top-level statements withtry/catch. Input7prints: Value: 7 Inputbadprints: FormatException
Expected Output:
Value: 7= newline. The output ends with a newline — print one after the last line.
Hints2 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.