MATLAB: How to determine how many numbers are displayed as a result of this for-loop

for loopMATLAB

for i=1:30
for j=1:30
for k=1:30
if(i*j*k ~= 900)
disp(i*j-1);
end
end
end
end
I could count the outputs but there's a lot. Is there a way I can come up with a function to determine the exact number of outputs? Or any other way to simplify the problem.

Best Answer

counter=0;
for i=1:30
for j=1:30
for k=1:30
if(i*j*k ~= 900)
disp(i*j-1);
counter=counter+1;
end
end
end
end
counter %determines number of outputs
Related Question