package StringProgram;
import java.util.*;class ReverseOrderString {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter a String: ");
String s1=sc.nextLine();
String s2="";
for(int i=0;i<s1.length();i++)
{
s2+=s1.charAt(s1.length()-i-1);
}
System.out.println("The actual string is: "+s1);
System.out.println("The reverse string is: "+s2);
sc.close();
}
}
No comments:
Post a Comment