First of all meghs, your pattern is not properly indented, it should be
* * *
* * * *
* * *
Second, you should have shown us how much you have tried. Let your code be full of errors, we'll point out your errors. But don't expect fully fledged answers for you to copy-paste. It is against the spirit of learning
Third, lostfate, you shouldn't have given out the answer just like that. Help him/her to understand the nature of the problem. At least someones brain neurons would have been tickled.
Forth, lostfate, please follow the standard coding practices, that is, int main() (with return ) and not just main()