• + 1 comment

    That was actually very helpful. I was able to convert that idea into this code.

    for(j=a[i]; j<b[i]; j++){ /* i<=t-1; */
        c = sqrt(j);
        d = c*c;
    
        if(d==j){
            s += 1; /* number of squares */
            j = b[i];
        }
    }
    
    while(d<=b[i]){
        c++;
        d = c*c;
    
        if(d<=b[i])
            s += 1;
    }
    

    I didn't use /* text */ in my code. It's just there for understanding.