using System;
class Program {
static void Main(string[] args) {
int[] a = new int[3];
int n = args.Length;
try {
if (n == 0) {
int d = 10 / (n);
}
if (n == 1) {
a[4] = 6;
}
} catch (IndexOutOfRangeException e) {
Console.WriteLine("Exception" + e);
} catch (DivideByZeroException e) {
Console.WriteLine("DivideByZeroException" + e);
} finally {
Console.WriteLine("finally block :: End of Program");
}
Console.ReadKey();
}
}This program is demonstrate error handling using try, catch and finally blocks in C#.
