Advertisement
_MuradPro_

MisparZeheMurad

Apr 3rd, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. public static void main(String[] args) {
  2.         int[] num = new int[10];
  3.         int count = 0;
  4.         for(int i=0; i<10; i++) {
  5.             if(NumberChecking(num[i]) == 1)
  6.                 count++;
  7.         }
  8.         System.out.println("There are " + count + " 'zehe' numbers");
  9.     }
  10.     public static int NumberChecking(int num) {
  11.         int i=0;
  12.         int num1 = num;
  13.         while(num > 0) {
  14.             num /= 10;
  15.             i++;
  16.         }
  17.         for(int j=0; j < i; j++) {
  18.             if(!(i == num1%10))
  19.                 return 0;
  20.             num1 /= 10;
  21.         }
  22.         return 1;
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement