-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram218.java
More file actions
58 lines (43 loc) · 1.08 KB
/
Copy pathprogram218.java
File metadata and controls
58 lines (43 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.util.Scanner;
class NNumberX
{
public int Arr[];
public NNumberX(int iSize)
{
Arr = new int[iSize];
}
public int CountEven()
{
int iCnt = 0;
int iCount = 0;
for(iCnt = 0 ; iCnt < Arr.length ; iCnt++)
{
if((Arr[iCnt] % 2) == 0)
{
iCount++;
}
}
return iCount;
}
}
class program218
{
public static void main(String A[] )
{
int iCnt = 0;
int iCount = 0;
int iRet = 0;
Scanner sobj = new Scanner(System.in);
System.out.println("Enter number of elements :");
int iSize = sobj.nextInt();
NNumberX nobj = new NNumberX(iSize);
System.out.println("Enter the element :");
for(iCnt = 0 ; iCnt < nobj.Arr.length ; iCnt++)
{
nobj.Arr[iCnt] = sobj.nextInt();
}
iRet = nobj.CountEven();
System.out.println("Number of Even elements are : "+iRet);
sobj = null;
}
}