I think my answer is not correct for this question, anyone can help me to check it? Thanks

2 次查看(过去 30 天)
Attached file is the question. Here is my code
B = 10000;
m = 0;
P = input('monthly payment?')
while B>0
B=B*(1.005);
B=B-P
m=m+1
end

采纳的回答

Salaheddin Hosseinzadeh
Hi,
It matches with your flowchart, Why do you thing it is not correct?
  4 个评论

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2015-6-27
B = 10000;
m = 0;
P = input('monthly payment?')
while B>0
B=B*(1.005);
B=B-P; %changed
m=m+1; %changed
end
disp(m); %changed

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by