Create a variable, A =64 and use While-loop to do the following:
i. Calculate how many numbers between 0 and A are divisible by 3.
ii. Save all the numbers divisible by 3 in a vector called B.
iii. Change the value of A to 100 and repeat the previous 2 steps.
Thos is a homework that i have and i can't even begin to understand how to write the conditions for this loop

댓글 수: 10

Do you know how to declare variables?
Example
A = 64;
Buti Al Falasi
Buti Al Falasi 2020년 4월 7일
yes
Buti Al Falasi
Buti Al Falasi 2020년 4월 7일
i know the basics of matlab but i don't know how to solve this question
What about this?
x/3
Buti Al Falasi
Buti Al Falasi 2020년 4월 7일
i know that ./ is for division but how do i write the condition for this .
though to be fair expect me to know nothing since i didn't use matlab for more than a week
mod function can say if number has remainder of division
if mod(x,3) == 0
disp('number is divisible by 3')
end
while loop using example
i = 1;
n = 10;
while i <= n
i = i + 1;
mod(i,3)
end
Buti Al Falasi
Buti Al Falasi 2020년 4월 7일
im doing a uni course for this and all they do is send a docement with instructions like do chapter 1 to 5 on matlab onramp then solve the homework so im really lost.
Buti Al Falasi
Buti Al Falasi 2020년 4월 7일
so thanks for the help
darova
darova 2020년 4월 7일
if you spend a bit of time on this you can handle it
haya Aldalama
haya Aldalama 2020년 4월 7일
What’s the answers for those questions

댓글을 달려면 로그인하십시오.

답변 (1개)

Srivardhan Gadila
Srivardhan Gadila 2020년 4월 10일

0 개 추천

Learn the essentials of MATLAB through MATLAB Onramp, two-hour introductory tutorial on commonly used features and workflows.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2020년 4월 7일

답변:

2020년 4월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by