On this question, it was put on hold for being too broad. Soon after that, three people posted their answers as unformatted code in a comment:
I thought that this defeated the purpose of placing a question on hold, so I flagged all three comments, which were all declined without reason. Is this acceptable, and if so, why?
Note that the question is a typical "homework" question, which according to these guidelines on answering homework questions shouldn't be answered with complete code unless it will specifically help out the user to understand how it works.