How can I create a for loop that takes the number 12000
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
May Kh
el 15 de Mayo de 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,....)
0 comentarios
Respuesta aceptada
Image Analyst
el 15 de Mayo de 2021
Editada: Image Analyst
el 15 de Mayo de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!