example 4-9: factorial