@jaiskid Not able to find what is wrong in logic. I want to start from last element for searching. When element foud return location of array. But the code is printing only -1
R9 found at last problem in running code
while taking input you have written cin>>arr[n] instead of cin>>arr[i];