Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int sumaCifrasDif(int n, int x) {
- if (n < 10) {
- if (n == x) { return 0; }
- else return n;
- }
- else {
- if (n % 10 != x) { return n % 10 + sumaCifrasDif(n / 10, x); }
- else return sumaCifrasDif(n / 10, x);
- }
- }
- public static int filtraCifrasX(int n, int x) {
- if (n < 10) {
- if (n == x) { return 0; }
- else return n;
- }
- else {
- if (n % 10 != x) { return (n % 10) + filtraCifrasX(n / 10, x)*10; }
- else return filtraCifrasX(n / 10, x)*10;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement