convert string to lowercase to uppercase or vice versa without using string function in java

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

public class anything {

public static void main(String[] args) {
System.out.print("Enter String in lowercase/uppercase:");
Scanner sc = new Scanner(System.in);
String lu = sc.next();
System.out.print("Your string in lowercas/uppercase:");
for (int i = 0; i < lu.length(); i++) {
int ch = lu.charAt(i);
if (ch > 64 && ch < 91) {
ch = ch + 32;
System.out.print((char) ch);

} else if (ch > 96 && ch < 123) {
ch = ch - 32;
System.out.print((char) ch);
}
if (ch == 32) {
System.out.print(" ");

}

}
System.out.println();
}
}

ahmetgenckaya
Автор

Show whether it is upper or lower case by taking input from users without using logical operators

I am confusing please tell me
Thank you

mohammadhasan
Автор

what if lowercase and uppercase both are present at the same time

pkjhabihar