0
Write a code to find the digit in a number in java
https://www.sololearn.com/discuss/1917768/?ref=app https://www.sololearn.com/discuss/1916032/?ref=app https://code.sololearn.com/ciwxNxlI4q7i/?ref=app https://code.sololearn.com/c6wbr3ehtg4j/?ref=app
3 Antworten
+ 3
The links seem irrelevant to the question.
0
Well I guess you could do some type manipulation with a little splash of iteration and condition
int num = 12345;
int digit = 4;
for(String n : Integer.toString(num).split("")) {
if(n.equals(Integer.toString(digit))) {
System.out.println("Found " + digit);
}
}