-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathevencheck.java
39 lines (39 loc) · 919 Bytes
/
evencheck.java
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
/* Count number of even digit in a number
* If the count greater than or equal to 3, then print "True" otherwise "False"
*/
import java.util.*;
public class evencheck
{
public static void main(String[] args)
{
int n;
Scanner sc = new Scanner(System.in);
int count = 0;
/*
n = sc.nextInt();
while(n>0)
{
int rem = n%10;
if(rem%2==0){
count++;
}
n = n/10;
}
*/
String num = sc.nextLine();
for (int i = 0; i < num.length(); i++)
{
if(Integer.parseInt(String.valueOf(num.charAt(i)))%2==0)
{
count++;
}
}
if(count>=3)
{
System.out.print("True");
}
else{
System.out.print("False");
}
}
}