top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+4 votes
90 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...