fix: ReversedString

This commit is contained in:
Sami 2024-11-16 13:51:40 -05:00
parent 47bab72ff3
commit b79fe73ffb
3 changed files with 46 additions and 0 deletions

Binary file not shown.

23
FindtheOne/Vowels.java Normal file
View File

@ -0,0 +1,23 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Vowels {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter your String here: ");
String str = sc.nextLine();
System.out.println(vowelsFound(str));
sc.close();
}
private static boolean vowelsFound(String str) {
String vowels = "aeoui";
for (char c : str.toLowerCase().toCharArray()) {
if (vowels.indexOf(c) != -1) {
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,23 @@
import java.util.Scanner;
/**
* ReversedString
*/
public class ReversedString {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter your String:");
String str = sc.nextLine();
System.out.println(revSTR(str));
}
private static String revSTR(String str) {
String revString = "";
for (int i = str.length() - 1; i >= 0; i--) {
char temp = str.charAt(i);
revString += temp;
}
return revString;
}
}