Write a function divide that divides two integers:
int divide(int a, int b)
If b == 0, it should throw a std::runtime_error with the message: Division by zero
b == 0
std::runtime_error
Division by zero
The program already reads two integers, calls divide, and uses try/catch to handle the exception. You only need to implement the divide function.
Example Input:
10 2
Output:
Result: 5
Here 10/2 = 5
Input:
7 0
Error: Division by zero
Here 7/0 = Not Divisible by 0 condition.
Test Cases
Test Results
Input
Expected Output