Generally, we try to help people figure things out, not hand them solutions. We feel they learn more doing it themselves rather that being spoon-fed the answer. Further, if this is a class assignment, it leads to possible ethical issues - if durgs prasad takes this code and turns it in, have they plagerized their answer?
In the future, please help people find the answer themselves. Give them tips or suggestions, subtle hints, etc. have them post what they have tried and point out errors, but please do not provide complete answers.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
harshvardhan ojha wrote:its ok fred, he already told that he is new
You are missing my point.
It is NOT ok. Around here, we don't care if someone has been coding 10 minutes or 10 years...We don't give out answers. That is the policy of this site. It is documented here and here. I suggest you read those before answering another post.