Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
help
  5 Commenti
the cyclist
the cyclist il 14 Mag 2022
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.

Accedi per commentare.

Risposte (1)

Sam Chak
Sam Chak il 14 Mag 2022
Modificato: Sam Chak il 14 Mag 2022
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 Commenti
Sam Chak
Sam Chak il 14 Mag 2022
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.

Accedi per commentare.

Categorie

Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange

Prodotti


Release

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by