static void print2Smallest(int []arr)
int first, second, arr_size = arr.Length;
Console.Write(" Invalid Input ");
first = second = int.MaxValue;
for (int i = 0; i < arr_size ; i ++)
else if (arr[i] < second && arr[i] != first)
if (second == int.MaxValue)
Console.Write("There is no second" +
Console.Write("The smallest element is " +
first + " and second Smallest" +
" element is " + second);
public static void Main()
int []arr = {10,4,7,3,34};