Rewrite ex33 to using for loop