package com.tutorial4u;
import java.util.Scanner;
public class ReverseString {
public static void main(String[] args) {
Scanner sc
= new Scanner(System.in);
System.out.print("Enter any String : ");
String str = sc.nextLine();
String reverseString = "";
System.out.print("Revesre string is : ");
for(int i = str.length()-1 ; i>=0;i--){
reverseString = reverseString+Character.toString(str.charAt(i));
}
System.out.println(reverseString);
}
}
Enter
any String : Tutorial4u
Revesre
string is : u4lairotuT
No comments:
Post a Comment