heres my code
int t1=min(x1,x2);
int t2=max(x1,x2);
fo(i,t1+1,t2){
y=m*i+c;
if(y-(int)y==0) sol++;
cout<<i<<" "<<y<<" "<<(int)y<<endl;
during running whenever i get y=some perfect integer then (int)y becomes (that integer -1) PS: y is double
ie if y=23.23 then its (int)y=23 thats fine but when y=24 then (int)y becomes 23
Check your data. If the double is perfectly integer, then it will be correctly truncated. It could be that you're actually receiving 24-epsilon, so when you print it or check with the debugger the value is being rounded to 24.
oh sorry actually fo(i,t1+1,t2)==for(int i=t1+1;i<t2;i++)
actually its a part of my code i just paste the relevent details
anyway in the solution they considering it as 24 i.e. its not that my debugger is rounding it to 24 but its a genuine int.
what do i need to do as 24 is counting as a integer my code is truncating all double values but returning 1 less values for perfect integers(atleast they are considering it as perfect int)