Skip to content

Commit 9363826

Browse files
committed
For loop practice.
Signed-off-by: Someshdiwan <[email protected]>
1 parent a04b840 commit 9363826

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import java.util.Scanner;
2+
3+
class A2
4+
{
5+
public static void main(String[] args)
6+
{
7+
Scanner sc = new Scanner(System.in);
8+
int n;
9+
System.out.println("Enter size of the Array");
10+
n = sc.nextInt();
11+
int [] A = new int[n];
12+
System.out.println("Enter n elements of");
13+
14+
for(int i =0; i<A.length; i++)
15+
{
16+
A[i] = sc.nextInt();
17+
}
18+
19+
System.out.println("Even Numbers are: ");
20+
for(int i = 0; i<A.length; i++)
21+
{
22+
if(A[i]%2==0)
23+
{
24+
System.out.println(A[i]);
25+
}
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)