Untitled

mail@pastecode.io avatar
unknown
plain_text
7 days ago
291 B
0
Indexable
Never
def seq_search(array,n,x):
    for i in range(0,n):
        if(array[i]==x):
            return i
    return -1

array =[2,4,0,1,9]
x=0
n = len(array)
result=seq_search(array,n,x)

if(result==-1):
    print("Element not found")
else:
    print("Element found at index:",result)
Leave a Comment