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
0 个评论
采纳的回答
Salaheddin Hosseinzadeh
2015-6-27
Hi,
It matches with your flowchart, Why do you thing it is not correct?
4 个评论
更多回答(1 个)
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 Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!