using System;
public class Program
{
public static void Main()
//Exception is event or unwantented behaviour which interupt the normal application
//exception can be handled using try catch block
//try block is block where we can expect the exception
Console.WriteLine("Hello World");
// int i= Program.devide(20,10);
// int i= Program.devide(20,0); //this the blok where exception can occcure
//handling exception
try
int i= Program.devide(20,0);
Console.WriteLine(i);
}
catch(Exception ex)
//Console.WriteLine("Error occured");
Console.WriteLine(ex.Message); //we can also use exception properties to show msg
Console.WriteLine("Thank you");
public static int devide(int num1,int num2)
int output=num1/num2;
return output;