Problem Set1 question3

add the piece of code for problem set1 q3