Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int count8(int n) {
- if(n == 0) return 0;
- if(n == 8) return 1;
- if(n % 10 == 8 && n / 10 % 10 != 8) return 1 + count8(n/10);
- if(n % 10 == 8 && n / 10 % 10 == 8) return 2 + count8(n/10);
- return 0 + count8(n/10);
- }
Add Comment
Please, Sign In to add comment