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

2 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh le 27 Juin 2015
Hi,
It matches with your flowchart, Why do you thing it is not correct?
  4 commentaires
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh le 27 Juin 2015
Good, then would you please accept the answer.

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 27 Juin 2015
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

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by