Make a code that tells if a number is odd or even
이전 댓글 표시
답변 (1개)
Bruno Teramoto
2019년 9월 26일
0 개 추천
x=input('Enter an integer:\n')
while round(x)~=x % use sentinel while loop if you are asked to make sure that
entered value is an integer
x=input('You entered invalid number. \nPlease Enter an integer:')
end
if rem(x,2)==0
fprintf('The Entered number is EVEN\n')
else
fprintf('The Entered number is ODD\n')
end
댓글 수: 1
James Tursa
2019년 9월 26일
Please don't post complete solutions to homework questions.
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
