MATLAB Answers

Create a script that will accept number of times user can input data. Identify if every input is either ODD or EVEN numbers. Count the number of ODD and EVEN numbers.

3 views (last 30 days)
Jan Vergel De Ocampo
Jan Vergel De Ocampo on 2 May 2021
Commented: Jonas on 2 May 2021
I got the idea on how to identify whether the number is odd or even but my problem is how to input "input command in loop" base on the number give by the user?

Answers (1)

Jonas on 2 May 2021
Edited: Image Analyst on 2 May 2021
just use something like this:
times=input('how many times')
for nr=1:times
numbers(nr)=input('give number');
and then further processing on the numbers array

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!