L9.5: Search an Array

PHOTO EMBED

Wed Oct 18 2023 13:09:10 GMT+0000 (Coordinated Universal Time)

Saved by @testpro #java

class Main {
    public static void main(String[] args) {

        int[] arr1 = {54, 44, 39, 10, 12, 101};
        for (int i=0; i<arr1.length; i++) {
            if (arr1[i] == 44) {
                System.out.println ("Array has a value of 44 at index " + i);
            }
        }
    }
}
// Output: Array has a value of 44 at index 1
content_copyCOPY