top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

C++ program to perform linear search on sorted array.

+4 votes
352 views

Please help me to write a C++ program to perform linear search on a sorted array?

posted Jan 31, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I am just providing the code block you need to complete the program -

void is_found(a, n , m)
{
  // a is the array 
  // n is the size of the array 
  // m is the number to be searched 
  for(i=0;i<=n-1;i++)
  {
    if(a[i]==m)
    {
      c=1;
      break;
    }
  }
  if(c==0)
    printf("\nThe number is not in the list");
  else
    printf("\nThe number is found");
}
answer Jan 31, 2014 by Luv Kumar
...