Q:

Exception Handling concept using C# Language

0

This Program is used to calculate divide by zero using exception handling concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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);

    }

}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now