code for exercise1