Not Getting Expected Output. What is wrong with my logic/syntax? Thanks in advance:)

Printable View