public static void Main()
int[] dataArray = new int[10] {76,44,65,22,87,88,33,44,25,70};
Console.WriteLine("Unsorted");
for (int index = 0; index < dataArray.Length; index++)
Console.Write(" "+dataArray[index]);
for ( int count =1; count < dataArray.Length; count++)
for ( int index = 0; index < dataArray.Length-1; index++)
if (dataArray[index] > dataArray[index + 1])
dataArray[index] = dataArray[index + 1];
dataArray[index + 1] = temp;
Console.WriteLine(" \nsorted");
for (int index = 0; index < dataArray.Length; index++)
Console.Write(" "+dataArray[index]);
int highIndex = dataArray.Length-1;
Console.Write("\nEnter search Value : ");
int searchValue = Convert.ToInt32(Console.ReadLine());
middle = (lowIndex + highIndex )/ 2;
while ( lowIndex < highIndex && foundIndex == -1)
if ( searchValue == dataArray[middle])
else if ( searchValue > dataArray[middle])
Console.WriteLine("{0} found at position {1}",searchValue,foundIndex );
Console.WriteLine("{0} not found",searchValue );