This is the working code for lab3