フィルターのクリア

write a MATLAB code to find the largest element in an array of 10 elements then check whether the number is ODD or EVEN Note: use only (for-loop and if-statement) method t

5 ビュー (過去 30 日間)
help
  5 件のコメント
3lewwi
3lewwi 2022 年 5 月 14 日
@Steven Lord bro i solved by another way but donot know how i solved it by use if or loop
the cyclist
the cyclist 2022 年 5 月 14 日
Regardless of whether this is homework or not, using the tips in the link I posted (and showing what you have tried so far) is the fastest method to get an answer. Volunteers here are more motivated to help you when we see that you are doing your part. This is not simply a consulting service where you post a problem and have someone do your coding for you.
You could also explain why you need to use a for-loop, which is clearly not the best way to solve this problem. (This is a hallmark of homework questions. That face, and the style of the prose, is why @Steven Lord and I have both assumed this is homework.)
So, maybe follow the advice of two people who have helped thousands of folks here, and do what we suggest.

サインインしてコメントする。

回答 (1 件)

Sam Chak
Sam Chak 2022 年 5 月 14 日
編集済み: Sam Chak 2022 年 5 月 14 日
I think the advice was misconstrued. Generally, the forum moderators never know whether it is a school homework or a company project.
As long as you post something that sounds like commanding others to complete the task for you (without showing your codes or at least findings from MathWorks / Wikipedia / Google results), then it will be flagged and probably deleted later.
Easiest way to avoid this is to show your findings about the properties of ODD and EVEN numbers. Give your ideas on how to solve the problem even though you don't know how to write the MATLAB Code.
Look up some good info about Parity. Hope it helps.
I randomly generated 10 integers. How do you determine whether the integers are ODD or EVEN numbers (without knowledge about the Parity)?
for i = 1:10
x(i) = round(100*rand);
end
x
  16 件のコメント
Torsten
Torsten 2022 年 5 月 14 日
編集済み: Torsten 2022 年 5 月 14 日
help randperm
Sam Chak
Sam Chak 2022 年 5 月 14 日
Thanks @Torsten. Learned new things today...
p = randperm(n) returns a row vector containing a random permutation of the integers from 1 to n without repeating elements.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by