Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bibliotecas
- import 'dart:io';
- // Funcao principal
- main() {
- // Entrada de dados
- stdout.write("# Taxa de juros: ");
- double tax_jur = double.parse(stdin.readLineSync()!);
- print(divida(tax_jur));
- }
- String divida(double taxa) {
- // Variaveis
- int lim = 3;
- int mes = 1;
- double acum = 0;
- double val_men;
- while (mes <= lim) {
- // Valor do pagamento
- stdout.write("\n# Deposito mensal: ");
- val_men = double.parse(stdin.readLineSync()!);
- // Calculo
- acum += val_men;
- acum += acum * taxa / 100;
- print("# Mes ($mes): R\$ " + acum.toStringAsFixed(2));
- // Incremento
- mes++;
- }
- return "\n# Total: R\$ " + acum.toStringAsFixed(2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement