Now i have changed k's type to "float"...still no error but also no squareroot is displayed,,but value of n is taken

#include
using namespace std;
int main()
{
int n,sum=0;
float k=1.0;
cin>>n;
label:
for(int i=0;;i=i+k)
{
if((i*i)>n)
{
i=i-1;
sum=sum+i;
k=k/10;
if(k==0.01)
{
goto end;
}
else goto label;
}
}
end:
cout<<"\n"<<sum;
return 0;
}

Hey @prerak_semwal
Mentioned the changes in your code https://ide.codingblocks.com/s/389486

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.