Wrap Errors with Context

JavaScript Medium 3 views
Back to Questions

Problem Description

Given a number x. If x is negative, throw an error 'NEG'. Catch it and print 'Bad input: NEG'. Otherwise print x*x.

Input Format

One integer x.

Output Format

One line output.

Sample Test Case

Input:
-4
Output:
Bad input: NEG

Constraints

x is integer.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next