if(arr[i]==k) return arr[i]; 1

if(arr[i]==k) return arr[i];

if(arr[i]==k){
return  arr[i];
}

Here is what the above code is Doing:
1. We are creating a function called find_element.
2. The function takes two arguments: an array and a number.
3. We are iterating through the array using a for loop.
4. If the number we are looking for is in the array, we return the number.
5. If the number is not in the array, we return -1.

Similar Posts