can anybody explain me please why the final output is coming in a reverse order??