Java: Check if an array of integers contains two specified elements
Write a Java program to check if an array of integers contains two specified elements 65 and 77.
Pictorial Presentation:
Sample Solution:
Java Code:
Sample Output:
Original Array: [77, 77, 65, 65, 65, 77] Result: true
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Java program to check if an array contains at least three consecutive prime numbers.
- Write a Java program to find all pairs of numbers that multiply to a given value.
- Write a Java program to check if an array contains at least one number greater than a given threshold.
- Write a Java program to check if two specific numbers exist at least twice in an array.
Java Code Editor:
Previous: Write a Java program to check if the sum of all the 10's in the array is exactly 30.
Next: Write a Java program to remove the duplicate elements of a given array and return the new length of the array.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.