How do I display squares of all even integers from zero to some positive integer input by the the user.And the program must continuously request a number from the user untill a valid a positive integer is entered
조회 수: 9 (최근 30일)
이전 댓글 표시
My code so far: M=input(enter integer) for c=0:m if (mod(m,2)==0) disp(m*m) end end
댓글 수: 0
답변 (1개)
Rafael Hernandez-Walls
2020년 8월 30일
M=input('enter integer:');
for c=0:M
if mod(c,2)==0
c^2
end
end
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!