-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from Wellers0n/challenge/4-emprestimo/rust/wel…
…lers0n Challenge 4 - Empréstimo
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |