Problems

Safe Division

EasyError Handling

Read two numbers a and b (one per line). Implement divide(a, b) that THROWS an Error with message division by zero when b is 0. Catch it and print the error message; otherwise print the quotient.

Input: two lines. Output: quotient or the error message.

Your program reads from stdin and prints to stdout.

Example 1

Input: 10 2

Output: 5

Hints

JavaScripttry-catch
Safe Division | CodeForge AI