Is my for loop correct

#include
using namespace std;

int main(){

int n;
int p;
cin>>n>>p;
float inc=1.0;
float N = 0;


for (int times=0; times<=p; times++){

	for(float N=0; N*N<=n; N++){

		N = N + inc;

	}
	N = N - inc;
	inc = inc/10;
}

cout<<N<<endl;

return 0;

}

Hey @sarthaks03
Actually your Inner loop is not correct
You don’t have to initialize N again with 0 and don’t have to increment it either
for(; N*N<=n; ){
N = N + inc;
}

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.