MATLAB: How can generalize several “For loop”

duplicate post requiring mergingforfor loop

Hello;
I want to generalize the expression.It goes "for i=5:n"……"for i=n:n".
I tried nested loop statement but couldn't manage..Is there any help? Thanks and regards
A=input('Enter nxn matrix:')
B=input('Enter solution matrix(n*1):')
[n n]=size(A);
L=zeros(n);
for i=1:n
L(i,i)=1;
end
for i=2:n
L(i,1)=A(i,1)/A(1,1);
end
for i=3:n
L(i,2)=A(i,2)/A(2,2);
end
for i=4:n
L(i,3)=A(i,3)/A(3,3);
end

Best Answer

A=input('Enter nxn matrix:')
B=input('Enter solution matrix(n*1):')
[n n]=size(A);
L=zeros(n);
for i=1:n
L(i,i)=1;
end
for k = 1:n
for i=k+1:n
L(i,k)= A(i,k)/A(k,k);
end
end