Adding number series using function (applying 'for' loop)