Here is source code of the C# Program to Demonstrate DivideByZero Exception. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
* C# Program to Demonstrate DivideByZero Exception
static void Main()
int result = 15 / int.Parse("0");
catch (DivideByZeroException e)
Here is the output of the C# Program:
Attempted to Divide by Zero
Sanfoundry Global Education & Learning Series – 1000 C# Programs.