CodeTantra interview question

Introduction two programs and ask me to solve them