int = input('');
l=numel(int2str(int));
t=num2str(int);
add = 0;
for i=1:l
add = add + str2double(t(i))^l;
end
if add == int
disp(int)
else
armstrong = int+1;
result = 0;
while armstrong~=result
result = 0;
for j = 1:l
result = result + str2double(t(j))^l;
end
if result == armstrong
disp(armstrong)
else
armstrong = armstrong+1;
end
end
end
Here is my code to find the armstrong number greater than the inputted number, but the code is not displaying the armstrong number. I could not identify the problem. The while loop does not stop and variable 'armstrong' gets greater and greater. Why could this be?