A simple exception handling using C#

Hi,

See how a very simple exception handling works with try-catch methods using C#.

using System;

class MainClass{

    public static void Main(){

        int divOne = 0;

        try {
            int ans = 79 / divOne ;
        }

        catch (Exception e) {
            Console.WriteLine("You got the exception-> " + e.Message);
        }

    }
}

Output- “You got the exception-> Attempted to divide by zero.”
:)