import java.util.*;
public class ReverseString{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.print("Enter String: ");
String st=input.nextLine();
String str[]=st.split("");
String reversedSt="";
for(int i=str.length-1;i>=0;i--){
reversedSt+=str[i];
}
System.out.println("Reversed String is: "+reversedSt);
}
}
public class ReverseString{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.print("Enter String: ");
String st=input.nextLine();
String str[]=st.split("");
String reversedSt="";
for(int i=str.length-1;i>=0;i--){
reversedSt+=str[i];
}
System.out.println("Reversed String is: "+reversedSt);
}
}
No comments:
Post a Comment