while loop condition help
古いコメントを表示
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 件のコメント
darova
2020 年 4 月 7 日
Do you know how to declare variables?
Example
A = 64;
Buti Al Falasi
2020 年 4 月 7 日
Buti Al Falasi
2020 年 4 月 7 日
darova
2020 年 4 月 7 日
What about this?
x/3
Buti Al Falasi
2020 年 4 月 7 日
darova
2020 年 4 月 7 日
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
2020 年 4 月 7 日
Buti Al Falasi
2020 年 4 月 7 日
darova
2020 年 4 月 7 日
if you spend a bit of time on this you can handle it
haya Aldalama
2020 年 4 月 7 日
What’s the answers for those questions
回答 (1 件)
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 についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!