Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- int[] num = new int[10];
- int count = 0;
- for(int i=0; i<10; i++) {
- if(NumberChecking(num[i]) == 1)
- count++;
- }
- System.out.println("There are " + count + " 'zehe' numbers");
- }
- public static int NumberChecking(int num) {
- int i=0;
- int num1 = num;
- while(num > 0) {
- num /= 10;
- i++;
- }
- for(int j=0; j < i; j++) {
- if(!(i == num1%10))
- return 0;
- num1 /= 10;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement