Please elaborate the code

what is a void pattern and why is the code not in int main but in void pattern? can you send an alternate code that is in int main?

hi @akshat1409, that is separated in a function for better readability and structure of code, same thing can be done in main also

refer:

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.

why did we use while loop and not for loop? until now we just used for loop for every question. How will i know what to use when?

hi @akshat1409, work of both is same use any of them no issues, with practice you’ll be comfortable dont worry now just keep learning

I am still not able to understand this code. can i arrange an online meet with you regarding thi question?

@akshat1409 do a dry run

https://ide.codingblocks.com/s/664680 please tell what is wrong? I tried implementing the code using for loops rather than while loops

hi @akshat1409
u have reopened the doubt. is there still anything? @talhashamim001 kindly look into it.

@Vaibhav277 ivent accepted this via admin portal

@talhashamim001 no issues. i will look into it…

1 Like

@akshat1409
Have a look at the corrected code–>

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.