필터 지우기
필터 지우기

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
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 CenterFile Exchange에서 Operating 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