% a=[1 2 3]; n=3; % function f=sum(a,n) % % Computing the sum of the elements of an array % sum1=0; for i=1:n, sum1=sum1+a(i); end f=sum1; s=sprintf('sum:%d',sum1); disp(s);