• + 2 comments

    Dude, you are using same m in your code... which will keep on becoming zero after completion from while loop and it will never be equal to j, better try out with this:

    include

    include

    using namespace std; int main() {

    long int i=0,j=0,k=0,m=0,x=0,d=0,r=0,m1=0;
    cin>>i>>j>>k;
    for(m=i;m<=j;m++)
    {
        r=0;
        m1=m;
        while(m1!=0)
        {
            d=m1%10;
            r=r*10+d;
            m1=m1/10;
        }
        if((abs(r-m)%k)==0)
            x++;
    }
    cout<<x;
    return 0;
    

    } I hope you got what's wrong.