if exist('A')==1
format compact;A,Arat=A;format rat;Arat,format short
irev=input('Type the number 1 to revise A ');
 else
 irev=1;end
if irev==1
 A=input('Type the new matrix A e.g.[1 2;3 4] ');
 end
goon=1;
while goon~=0
A,Arat=A;format rat;Arat,format short
fprintf('1 to divide;2 for one type 3 row op (*row+); \n')
v=input(' 3 to revert;4 to swap rows;5 to stop: ');
if v==3
  atmp=A;A=aprev;aprev=atmp;
  else
  aprev=A; end
if v==5, goon=0; end
if v==1
 r=input('Divide row ');
 x=input(' by the following number: ');
 A(r,:)=A(r,:)/x;
 end
if v==4
 r=input('Swap row ');
 x=input(' with row ');
 tmp=A(r,:);A(r,:)=A(x,:);A(x,:)=tmp; end
if v==2
 r=input('Replace row ');
 c=input(' with itself plus c * Row j, where c= ');
 j=input(' and j= ');
 A(r,:)=A(r,:)+c*A(j,:); end
 end
 disp('Type rowop if you want to rerun this program; type exit to quit')
return
