Take 10 integer inputs from user and store them in an array. Again ask user to give a number. Now, tell user whether that number is present in array or not write a java program.
Answers
Answered by
1
Answer:
public class PrintArray {
public static void main(String[] args) {
//Initialize array
int [] arr = new int [] {1, 2, 3, 4, 5};
System.out.println("Elements of given array: ");
//Loop through the array by incrementing value of i
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
}
}
Explanation:
Similar questions