Unidentified error in code

unable to find error code is not working for number other than expected number

you are re-intializing i in line 13, dont do that

1 Like

what would be the 3rd condition for for loop?

for(int i=0;i<=n-1;i++)

would change to

for(i=0;i<=n-1;i++)

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.