by while loop . loop body is in between { } but this solution cout<<sum <<endl;
written in out of { ] this bracket .its right
by the while loop is not true
Using the while loop
while () { cout<<sum<<endl;} out put not write in solution its false .but in while loop cout write in {} in bracket
@mohitenikhil888 if you will do cout<< sum in while loop then it will print the result everytime but if you will do after the while loop then only the final result will be printed.
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.