title: Linear Search Code Shows that my item is not present.Please help me make corrections
body: <blockquote>
    <p>This is the function for linear search where i am only taking one variable x that is the to search for item variable</p>
  </blockquote>
  
  <pre><code>int lsrch(int x)
      {int i;
      int arr[6] = {2,4,5,76,2,1};
      for(i=0;i&lt;5;i++)
      {
          if(x==arr[i])
          {
              return i;
          }
          else
              return -1;
      }
      }
  
      int main()
      {
          int a,b;
          a=lsrch(76);
  </code></pre>
  
  <blockquote>
    <p>76 is present so it should show its index location but it shows -1 for both meaning both are not present true for 2nd test case</p>
  </blockquote>
  
  <pre><code>        b=lsrch(99);
          printf("%d",a);
          printf("%d",b);
      }
  </code></pre>