andreykata

ArraysExercise11

Jan 14th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3.    class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             int[] array = { 1, 3, 5, 6, 9, 10, 12 };
  8.             int searchNumber = 6;
  9.             int position;
  10.             position = Array.BinarySearch(array, searchNumber);
  11.             if (position > 0)
  12.             {
  13.                 Console.WriteLine(position);
  14.             }
  15.             else
  16.             {
  17.                 Console.WriteLine("The array doesn't has searching number");
  18.             }
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment