§ A: array name.
§ N: number of elements in array.
§ Item: value to be searched.
§ Loc: location of item to be searched.
STEP 1: Set a [n+1] = item
STEP 2: Set LOC = 1
STEP 3: Repeat while a [loc] != item
LOC = LOC + 1
STEP 4: If LOC = N+1 then,
Search is successful
LOC = 0 & search is unsuccessful
STEP 5: Exit
§ To start the linier search, its is first assumed that the ITEM is inserted into array at the last location N+1
as A [N+1] = ITEM
§ Then, the location counter ‘LOC’ is set to 1, to start the search, the value of the variable to be searched would be started from 1.
§ The location counter is them incremented, till the location of value to e searched becomes equal to the location counter.
§ If the location counter becomes equal to (n+1), then, the value to be searched is present at that location and the search is successful, otherwise, the location counter becomes ‘zero’ and the search is unsuccessful
printf("enter array elements");
printf("enter search item");
ss:printf("item not present");