Prime Letters = Removing | MATLAB
Code:
function y = primeLetters(x)
y = double(x);
z=[];
temp=0;
for i=1:length(x)
t=x(i);
for j=2:t/2
if(rem(x(i),j)==0)
temp=temp+1;
end
end
if(temp~=0)
z=[z t];
end
temp=0;
end
y=char(z);
end
function y = primeLetters(x)
y = double(x);
z=[];
temp=0;
for i=1:length(x)
t=x(i);
for j=2:t/2
if(rem(x(i),j)==0)
temp=temp+1;
end
end
if(temp~=0)
z=[z t];
end
temp=0;
end
y=char(z);
end
No comments