Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner in = new Scanner(System.in);
- int count = 0;
- int digit = in.nextInt();
- int num = in.nextInt();
- int thd = num/1000;
- int hnd = (num%1000)/100;
- int tns = (num%100)/10;
- int ones = num%10;
- if (ones == digit)
- count++;
- if (tns == digit)
- count++;
- if (hnd == digit)
- count++;
- if (thd == digit)
- count++;
- System.out.print(count);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement