Matlab program that keeps prompting the user for integers until a negative number is entered

then the program should then create two new vectors, odds and evens which contain the odd and even numbers, respectively, entered by the user.

3 Comments

so far i only write instruction that will ask user to enter integers, until negative no is entered.
a = input('Enter an integer:,\n');
while (a>=0)
a = input('Enter an integer:,\n');
end
How do i want to sort all the previous integers entered into an odds and even vector?
How will you test whether an integer is odd or even? Is 0 odd or even?
Have you read MATLAB's documentation about using arrays?

Sign in to comment.

Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Tags

Asked:

on 4 Apr 2013

Community Treasure Hunt

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

Start Hunting!