Make a code that tells if a number is odd or even

답변 (1개)

Bruno Teramoto
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

Please don't post complete solutions to homework questions.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

2019년 9월 26일

댓글:

2019년 9월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by