Create a program that uses exception handling to handle division by zero errors.
MediumProblem Statement
Create a program that uses exception handling to handle division by zero errors.
Sample Input
int a = 10; int b = 0;
Sample Output
Result: Division by zero error.
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <iostream>
#include <stdexcept>
int divide(int a, int b);
int main() {
int a = 10, b = 0;
// Logic to perform division and handle exceptions
return 0;
}
Input
int a = 10; int b = 0;
Expected Output
Result: Division by zero error.