#include <stdio.h> int search(int a[], int length, int x) { /* x is a query number */ int i; for (i=0;i<length;i++) { if (x == a[i]) { return i; } } return -1; } int main() { int m; int index; int a[10] = {3, 4, 5, 6, - 10, 101, 76, 83, -1, 67}; /*int b[] = {2,4, 8, 16, 14 ,12, 4, 7, 0};*/ do { printf("Enter number: "); scanf("%d", &m); if (m != 0) { index = search(a, 10, m); if (index>=0) { printf("Found: a[%d] = %d\n", index, m); } else { printf("Not Found\n"); } } } while (m != 0); return 0; }