Loading, please wait...

A to Z Full Forms and Acronyms

Exception Handling concept using C# Language

Jun 30, 2018 Exception Handling, 1496 Views
This Program is used to calculate divide by zero using exception handling concept.
using System;



class MyClient

{

   public static void Main()

   {

      int x = 0;

      int div = 0;



      try

       {

          div = 100/x;



          Console.WriteLine("Not executed line");

       }

         catch(DivideByZeroException de)

           {

               Console.WriteLine("\nDivideByZeroException" );

            }



         catch(Exception ee)

           {

               Console.WriteLine("\nException" );

            }

         finally

           {

               Console.WriteLine("\nFinally Block");

            }

         Console.WriteLine("\nResult is {0}",div);

    }

}
A to Z Full Forms and Acronyms

Related Article