Click Here To Follow our Telegram Channel for more such news and amazing free stuffs.
Telegram Channel - https://t.me/codexelltech
import java.util.*;
class ReverseString
{
public static void main(String args[])
{
String original, reverse="";
Scanner s= new Scanner(System.in);
System.out.println("Enter a string to reverse");
original=s.nextLine();
int length=original.length();
for(int i=length-1 ; i>=0 ; i--)
{
reverse = reverse + original.charAt(i); //charAt()
}
System.out.println("Reverse of the string: " +reverse);
}
}
Output:
Enter a string:
block
Reverse string is= kcolb
Click Here To Follow our Telegram Channel for more such news and amazing free stuffs.
Telegram Channel - https://t.me/codexelltech
Click here to visit www.codexell.tech for more such references.
Telegram Channel - https://t.me/codexelltech
import java.util.*;
class ReverseString
{
public static void main(String args[])
{
String original, reverse="";
Scanner s= new Scanner(System.in);
System.out.println("Enter a string to reverse");
original=s.nextLine();
int length=original.length();
for(int i=length-1 ; i>=0 ; i--)
{
reverse = reverse + original.charAt(i); //charAt()
}
System.out.println("Reverse of the string: " +reverse);
}
}
Output:
Enter a string:
block
Reverse string is= kcolb
Click Here To Follow our Telegram Channel for more such news and amazing free stuffs.
Telegram Channel - https://t.me/codexelltech
Click here to visit www.codexell.tech for more such references.