Program that separates even and odd numbers and shows them in two vectors.
Afficher commentaires plus anciens
The program must throw 100 in two vectors, in one the 50 pairs will be shown and in the other 50 odd. All this using the cilco for and conditions if they are necessary. I already got him to throw the numbers but to separate them.
Réponse acceptée
Plus de réponses (1)
KSSV
le 4 Fév 2019
A = magic(5) ;
A = A(:) ;
idx = mod(A,2)==0 ;
E = A(idx) ; % Even numbers
O = A(~idx) ; % Odd numbers
1 commentaire
Dionisio Mendoza
le 4 Fév 2019
Catégories
En savoir plus sur Language Fundamentals dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!