Program that separates even and odd numbers and shows them in two vectors.
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
その他の回答 (1 件)
KSSV
2019 年 2 月 4 日
A = magic(5) ;
A = A(:) ;
idx = mod(A,2)==0 ;
E = A(idx) ; % Even numbers
O = A(~idx) ; % Odd numbers
参考
カテゴリ
Help Center および File Exchange で Web Services についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!