Jump to content
Fórum Script Brasil
  • 0

Java Script


Danielli Caetano

Question

Usando laços de repetição, criar um script que calcule o total final de uma divida financiada, no valor inicial de R$ 10000,00, por 5 anos a uma taxa anual de 12% de juros ao ano

<html>
<head>
<title>Exercício 10</title>
</head>
<body>
&lt;script Language="JavaScript">
var inicial = 10000;
var perc = 12;
var anos = 5;
var fim =0;
for (var x = 1;x<=anos;x++) {
    fim  = inicial + ((inicial * (perc/100))*x);
}
document.write(parseFloat(fim));
</script>
<form>
</form>
</body>
</html>
Criar uma função denominada calç_juros() que faça os cálculos definidos no exercício acima
<html>
<head>
<title>Exercício 13</title>
</head>
<body>
&lt;script Language="JavaScript">
function calc_juros() {
    var inicial = 10000;
    var perc = 12;
    var anos = 5;
    var fim  = inicial + (inicial * ((perc/100)*anos));
    document.write(fim);
}
</script>
<form>
<input type="button" value="Calcular juros" onClick="java script:calc_juros();" />
</form>
</body>
</html>

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...