two different ways for problem one