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

1 visualizzazione (ultimi 30 giorni)
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,....)

Risposta accettata

Image Analyst
Image Analyst il 15 Mag 2021
Modificato: Image Analyst il 15 Mag 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.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by