public static void Main()
int [] a = { 1, 2,3, -7, 6, 8, -10, 15,4,6,8,9,5};
Console.WriteLine("Smallest Positive Number missing is : " + GetSmallestPos(a));
static int GetSmallestPos(int[] a)
for (int i=0; i< a.Length; i++)
if (a[i]>0 && minFlag==0)
else if (i+1 < a.Length && (a[i+1]-a[i] >1))
minMissing = a[a.Length-1]+1;