โ Back to Exceptions
Question 658
Invalid Operation Exception
Invalid Operation Exception
Read acount. If it is0,throw new InvalidOperationException("stack is empty"); otherwise printPopped from <count> items. Catch the exception and printError: <message>. Use top-level statements withtry/catch. Input3prints: Popped from 3 items Input0prints: Error: stack is empty
Expected Output:
Popped from 3 items
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.