rewrite the function multiplication written with dotimes and apply