Skip to content

Commit

Permalink
Merge pull request #97 from Wellers0n/challenge/4-emprestimo/rust/wel…
Browse files Browse the repository at this point in the history
…lers0n

Challenge 4 - Empréstimo
  • Loading branch information
lanjoni authored Oct 5, 2023
2 parents a63cb0f + f9c773c commit f899e4b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions challenges/4-emprestimo/rust/wellers0n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Submissão de Exercicio

**Exercicio:** 4 - Emprestimo

**Nickname:** wellers0n

**Nível Técnico:** Software Engineer

**Empresa:** Bankme

**Twitter**: https://twitter.com/wellers0n_

**Dificuldade de Resolução:** média

**Comentários:** Divertido

**Como rodar o desafio**:

Use o comando abaixo:

```bash
rustc main.rs
./main 1000.00 10 1
```
19 changes: 19 additions & 0 deletions challenges/4-emprestimo/rust/wellers0n/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use std::env;

fn main() {
let args: Vec<String> = env::args().collect();

if args.len() < 2 {
eprintln!("Nenhum argumento foi fornecido.");
return;
}

let valor_emprestimo = args[1].parse::<f64>().unwrap();
let taxa_juros = args[2].parse::<f64>().unwrap();
let tempo = args[3].parse::<f64>().unwrap();

let resultado = valor_emprestimo * (1.0 + taxa_juros / 100.0).powf(tempo);

println!("{:.2}", resultado);

}

0 comments on commit f899e4b

Please sign in to comment.