What happens if I don't handle a divide by zero error in C#?

Responsive Ad Header

Question

Grade: Education Subject: Support
What happens if I don't handle a divide by zero error in C#?
Asked by:
60 Viewed 60 Answers

Answer (60)

Best Answer
(364)
If you don't handle a `DivideByZeroException`, your program will terminate abruptly. The exception will propagate up the call stack until it's caught by an exception handler (a `try-catch` block). If no handler is found, the program will crash, displaying an error message to the user or logging the error to a file (depending on your application's configuration).