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

1 view (last 30 days)
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,....)

Accepted Answer

Image Analyst
Image Analyst on 15 May 2021
Edited: Image Analyst on 15 May 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.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!