- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace ForgetCode
- {
- class Program
- {
- static void Main(string[] args)
- {
- int top = 0, bottom = 0, result = 0;
- try
- {
- result = top / bottom;
- }
- catch (System.DivideByZeroException ex)
- {
- // Custom message for easy understanding
- Console.WriteLine("You have attempted to divide a number with zero");
- }
- }
- }
- }
- You have attempted to divide a number with zero