Write a code to find the digit in a number in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
2 Answers
+ 3
The links seem irrelevant to the question.
7th Aug 2019, 8:43 AM
Sonic
Sonic - avatar
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); } }
7th Aug 2019, 9:07 AM
Jake
Jake - avatar