We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a0d3c70 commit 1e17b7dCopy full SHA for 1e17b7d
1 file changed
evencheck.java
@@ -1,14 +1,16 @@
1
-
+/* Count number of even digit in a number
2
+ * If the count greater than or equal to 3, then print "True" otherwise "False"
3
+ */
4
import java.util.*;
5
public class evencheck
6
{
7
public static void main(String[] args)
8
9
int n;
10
Scanner sc = new Scanner(System.in);
- n = sc.nextInt();
11
int count = 0;
12
+ /*
13
+ n = sc.nextInt();
14
while(n>0)
15
16
int rem = n%10;
@@ -17,6 +19,15 @@ public static void main(String[] args)
17
19
}
18
20
n = n/10;
21
22
23
+ String num = sc.nextLine();
24
+ for (int i = 0; i < num.length(); i++)
25
+ {
26
+ if(Integer.parseInt(String.valueOf(num.charAt(i)))%2==0)
27
28
+ count++;
29
+ }
30
31
if(count>=3)
32
33
System.out.print("True");
0 commit comments