I have tried with the below code. Please help me to get the output. I want simple code that I can understand.
Suppose that number is 40:
public class PositionofElementinArray {
    public static void main(String args[]) {
    int arr[] = {10, 20, 30, 40, 50};
    int value = 40;
    for(int i=0; i < arr.length; i++)
        if(arr[i]==value){
            System.out.print(arr[i]);            
    }
        else{
        System.out.print("no element found");
    }
 }
}
 
     
     
    