exercise 3: triangle type