Safe Division (Error Handling)

Read two integers a b. Print a / b using integer division (rounding toward zero), or error: division by zero when b is 0.

Input: Two integers.

Output: The quotient or the error message.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Check for zero before you divide.

More Error Handling practice