Anything you can say in comments can be phrased in a friendly way, an unfriendly way, and a neutral way.
Neutral, short responses can sometimes come across as unfriendly. That's because on the Internet, nobody can see your facial expressions.
In fact, no matter what you write, it's going to be interpreted by different people at different points on the friendly/unfriendly spectrum. You're not likely to score 100% on the friendly-meter no matter what you say, but we can try to improve where we land on the spectrum.
Taking the common case of someone who hasn't provided enough information...
Question: "I'm trying to xxx and it's not working."
Fairly unfriendly comment: "Look, we're not mind readers here. What do you mean it's not working?"
Relatively neutral comment: "What did you expect to see, and what did you see instead?"
Fairly friendly comment: "Sorry to hear that... I hope we can help you! But we need a bit more information. What did you expect to see, and what did you see instead?"
These are all just different wordings of the same question, meant to evoke the same response, although (1) and (3) carry with them additional emotional content. Think of it as a CSS page that adds friendliness or unfriendliness without changing the semantic content on the HTML page...
Some things to note about this situation.
Friendliness almost always takes more words. If that bothers you, maybe you would be happier moving on to another question and letting someone else answer this one right now. There's nothing wrong with that.
You may argue that certain new users need to be educated on the proper way to ask, and if they refuse to be educated, we don't want or need them around -- the site has plenty of questions without them! But this misses two important points.
First, the friendly comment (#3) is far more likely to help educate someone the proper way to ask. You get more flies with honey, sugar. That's just the way of the human species.
Second, the snarky comment (#1) is seen by dozens or hundreds of people who did not ask a question the wrong way. All those "innocent bystanders" are going to think that Stack Overflow is an unfriendly community and could be reluctant to contribute in the future.
An important thing to remember is that asking incomplete questions is actually the way human beings normally operate in real life.
EXAMPLE HUMAN CONVERSATION:
"Hey Joe, something's wrong here..."
"What is it?"
"Well, this function I'm calling isn't working..."
"Looks OK to me. What were you expecting?"
That is a normal, In Real Life(TM) human conversation.
FOR COMPARISON:
"Hey Joe, I'm calling this function, and I expected a 27.5, but I got 29.5. Now according to Google..."
"Whoa horsey... slow down!"
The fact is that people are bringing their HUMAN style of asking questions to Stack Overflow, where we expect a non-human, "all the info up front" style, and this is why they get in trouble. And all that means is that they're just acting like human beings--there's no reason to torture them for it. This is exactly why we have comments... so you can ask follow-up questions and drill down to a good repro case.
Usually friendliness can be added to anything by adding a few friendly words.
"Welcome to Stack Overflow! ..."
"Thanks for asking! ..."
"I hope that was helpful! ..."
"I'm glad you asked! ..."
"Could you do me a favor? ..."