How can I create a for loop that takes the number 12000

1 vue (au cours des 30 derniers jours)
May Kh
May Kh le 15 Mai 2021
Modifié(e) : May Kh le 15 Mai 2021
How can I create a for loop that takes the number 12000 (Annual salary) and multiplies it by 1.1( increase every 7 years) every 7 years (7,14,21,...), meaning that i want the answer as follows: 12000*(1+n).... 12000*1.1*(1+n)....12000*1.1*1.1*(1+n)....12000*1.1*1.1*1.1*(1+n) etc knowing that n is the years (7,14,21,....)

Réponse acceptée

Image Analyst
Image Analyst le 15 Mai 2021
Modifié(e) : Image Analyst le 15 Mai 2021
salary = 12000
for n = 7 : 7 : 63
salary = salary * 1.1
end
Note : since you're only multiplying by 1.1 every 7th year, it should not be called an "annual increase" since it does not increase annually. It increases only every 7th year.

Plus de réponses (0)

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by