Answers:
You seem to be displaying, starting from i=2, as a result of the statement i=i+2.
In while statement, you have put a condition that your code should not display values more than 25, so no need to write if statement again. Also, if you interchange the line 'disp(i)' with the line given above, you'll get the desired result.
So the code should be as follows:
i=1;
while(i<=25)
disp(i)
i=i+2;
end
while(i<=25)
disp(i)
i=i+2;
end
Login to add comment