int func(int a, int b) { if (b == 0) // can't divide by 0 longjmp(buf, -3); return a / b; }
int divide(int a, int b) { return func(a, b); } int main() { int a, b; while (scanf("%d %d", &a, &b) == 2) { if (setjmp(buf)) puts("Cannot / 0"); else printf("%d\n", divide(a, b)); } }