function example clear all r=sumofcubes(20); fprintf('The sum of the first 20 cubes is %i\n',r) % function r=sumofcubes(N) ans=0; for i=1:N ans=ans+i^3; end r=ans;