Https://ide.codingblocks.com/s/253625

why its not running right

Hello @Aditya-Kushwaha-914550392281281,

You have used the wrong formula in your code which causing wrong output.

Check the following code:

Let me know if you don’t understand something.
Hope, this would help.

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.

https://ide.codingblocks.com/s/269670 why its showing errors even i did everything right

hello @Aditya-Kushwaha-914550392281281

image
it is showing wa because in these while loops u are changing value of n (which u r not supposed to do).
because we need its value for furthur comparision.
so to rectify it store value of n in some other variable and use that variable in place of n in these while loop.

thanx bhaiya i resloved it