Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: resolvido challenge inverter String #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions challenge-inverter-string/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.println("Insira a String que deseja inverter:");
String string = scanner.nextLine();

System.out.println("String invertida: " + inverterString(string));

scanner.close();
}

public static String inverterString(String string) {
String stringInvertida = "";

for (int i = string.length() - 1; i >= 0; i--) {
stringInvertida += string.charAt(i);
}

return stringInvertida;
}
}
14 changes: 14 additions & 0 deletions challenge-inverter-string/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Dada uma string ou texto, inverta a sua ordem.

Descrição da Função
A função deve ser capaz de receber uma string e retornar o seu valor invertido.

Exemplos de Entrada
"WoMakersCode"
"Wo Makers Code"
"A mae te ama"

Exemplos de Saída
edoCsrekaMoW
edoC srekaM oW
ama et eam A