Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void contaDigitos(int a, int b)
- {
- int count = 0;
- LinkedList<Integer> stack = new LinkedList<Integer>();
- while (a > 0) {
- stack.push(a % 10);
- a = a / 10;
- }
- while (!stack.isEmpty()) {
- if (stack.pop() == b)
- count++;
- }
- System.out.println(count);
- }
- }
Add Comment
Please, Sign In to add comment