Skip to content

Instantly share code, notes, and snippets.

@caio-nas
Forked from anonymous/jsbin.zoqocibi.html
Last active August 29, 2015 13:58
Show Gist options
  • Save caio-nas/10163942 to your computer and use it in GitHub Desktop.
Save caio-nas/10163942 to your computer and use it in GitHub Desktop.
Calculador de rendimentos de investimento em juros compostos
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
var investimentoMensal = 800;
var montante = 0;
var taxaRendimento = 0.005;
for(ano = 1; ano <= 10; ano++){
for(mes = 1; mes <= 12; mes++){
montante = Math.round(montante * (1 + taxaRendimento));
montante += investimentoMensal;
document.write("Mês " + mes + ": " + montante + "<br/>");
}
document.write("<b>Ano " + ano + ": " + montante + "<br/></b>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment