- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount.java
More file actions
Latest commit
30 lines (29 loc) · 685 Bytes
/
Copy pathcount.java
File metadata and controls
30 lines (29 loc) · 685 Bytes
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
importjava.util.*;
classcount
{
publicstaticvoidmain(Stringargs[])
{
Scannerscan=newScanner(System.in);
inta[]=newint [50];
intlimit,i,ceven=0,codd=0;
System.out.println("Enter limit of the array:");
limit=scan.nextInt();
for(i=0;i<limit;i++)
{
a[i]=scan.nextInt();
}
for(i=0;i<limit;i++)
{
if(a[i]%2==0)
{
ceven++;
}
else
{
codd++;
}
}
System.out.println("Even no"+ceven);
System.out.println("Odd no"+codd);
}
}