int count=0;
if((second%10)==first){
count++;
}
if(Math.round((second/10))==first){
count++;
}
System.out.println(first+" occurs "+count+" times in "+second);
Maybe this can help you ;), replace your last println by this 8 lines 😉
but as shmosel sait in comment, be carreful it’s
int first = n.nextInt(10);
int second = n.nextInt(90)+10;
0
solved How to check how many times one number appears in the second number? [closed]