Do you know how to solve this problem on paper? Why don't you right out the steps for a linear search and list them. The logic above is not what you want.
Do you know how to solve this problem on paper? Why don't you right out the steps for a linear search and list them. The logic above is not what you want.
my brain is literally stopped
this is what i came with:
Code:for(i=0;i<10;i++) if (list[i]==s) { printf("%d is found at location %d\n", s,i+1); break; } if (list[i]!=s) printf("%d is not found\n",s); return -1; }
it works ! but i don't know if it's logically correct
what do you think ?