Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. Scanner in = new Scanner(System.in);
  2.     int count = 0;
  3.     int digit = in.nextInt();
  4.     int num = in.nextInt();
  5.     int thd = num/1000;
  6.     int hnd = (num%1000)/100;
  7.     int tns = (num%100)/10;
  8.     int ones = num%10;
  9.     if (ones == digit)
  10.         count++;
  11.      if (tns == digit)
  12.         count++;
  13.      if (hnd == digit)
  14.         count++;
  15.      if (thd == digit)
  16.         count++;
  17.     System.out.print(count);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement