Why my code is not working here as compared to eclipse where everything is alright and output is also right

package startingwithjav;
import java.util.Scanner;

public class count {

public static void main(String[] args) {
	 Scanner scn=new Scanner(System.in);
        int num=scn.nextInt();
        Scanner sc=new Scanner(System.in);
        int d=sc.nextInt();
        int count=0;
        while(num>0)
        {
            if (num%10==d)
            count++;
            num=num/10;

        }
        System.out.print(count);

    }

}

Hi @Hemanshu_raina,
You have a typo mistake …In int d = sc.nextInt()
you have to write scn instead of sc … int d = scn.nextIntI();

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.