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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
help
5 commentaires
the cyclist
le 14 Mai 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.
Réponses (1)
Sam Chak
le 14 Mai 2022
Modifié(e) : Sam Chak
le 14 Mai 2022
Hi @3lewwi
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 commentaires
Voir également
Catégories
En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!