• + 0 comments

    Actually there is no need to introduce "reverse += number".It's working well without the use of it. here is my code: import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;

    public class Solution {

    public static int reverse(int a)
    {
    
        int reverse = 0;
        while(a!=0)
        {
            reverse = reverse * 10;
            reverse = reverse + a%10;
            a = a/10;
        }
        return reverse;
    
    }
    
    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner in = new Scanner(System.in);
        int i = in.nextInt();
        int j = in.nextInt();
        int k = in.nextInt();
        //int n = i-j+1;
      //  int s[] = new int[n];
        int count = 0;
        for(int a = i;a<j+1;a++)
        {           
           int d= a-reverse(a);
           if(d%k==0)
               count++;
        }
        System.out.println(count);
    }
    

    }