Puhleeeease check this
For what? Don't give us a code dump and set us off with "find the errors". We can do bug hunting on our own code, thanks. Ask a real question.
Isnt giving the correct output ...
So maybe you should program it to give the correct output. If you don't give us anymore details than "it is not correct", than we won't give you a response any better than "make it correct".
Details please. What do you observe? What did you try? Where did you narrow the problem down to? Don't dump work on us with little information.
EDIT: As a hint, try to use braces more explicitly. It makes it clear what the blocks of code are. This is especially true in if/else one liners, which when nested without the braces can become confusing to read. You don't know what else matches to what if.