Please don’t post the same question multiple times, this seems to be the same issue as in this thread.
Also is this a homework problem? I ask as someone posted the same question on StackOverflow yesterday and removed it after I asked whether it was a homework problem. It’s fine to ask for help with homework here, but you might want to have a look at our informal homework policy.