Added the code for execise2.6