suppose we have following script for prime factorization
z=input('enter your number : ');
for ii=2:z
s=0;
while z/ii==floor(z/ii) % check if z is divisible by ii
z=z/ii;
s=s+1;
end
if s>0
str = [num2str(ii) '^' num2str(s) ];
disp(str) ;
% If z = 1, no more divisions are necessary,
% thus breaks the loop and quits
if z == 1
break
end
end
end
but output of this code is not formatted well,for instance
>> integer_factorization
enter your number : 30
2^1
3^1
5^1
how can i do so that i got
30=2^1*3^1*5^1?
thanks in advance