๐Ÿ”’ Closed Help java

Status
Not open for further replies.

Phc-AJDS

Eternal Poster
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
  • 574
    Views
  • 3
    Participants
Last reply from:
lemoneyd

Online now

Members online
896
Guests online
699
Total visitors
1,595

Forum statistics

Threads
2,276,945
Posts
28,973,258
Members
1,229,658
Latest member
hihiwae
Back
Top