🔒 Closed Help java

Status
Not open for further replies.
Write a program using one-dimensional array that determines the even numbers among the ten input values from the keyboard and prints the list of these Even numbers.

sample:

Enter ten numbers:

8 9 7 10 25 30 69 101 1001 798

Here is the list of Even number/s:

8 10 30 798
 
int[] num2 = new int[10];
System.out.println("Enter ten numbers:");
for (int x=0;x<10;x++){
System.out.println("Number "+(x+1)+":");
Scanner myObj = new Scanner(System.in); // Create a Scanner object
int num = myObj.nextInt();
num2[x]= num;
}
System.out.println("Here is the list of Even number/s:");
for (int x=0;x<10;x++){
if(num2[x]%2==0){
System.out.print(num2[x]+" ");
}
}
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 609
    Views
  • 3
    Participants
Last reply from:
lemoneyd

Trending Topics

Online now

Members online
524
Guests online
11,457
Total visitors
11,981

Forum statistics

Threads
2,359,210
Posts
29,405,249
Members
1,068,265
Latest member
kjl-1
Back
Top