1
1 answers
0
import java.util.*;
class Rev{
public static void main(String args[])throws InputMismatchException{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a word: ");
String word = sc.next();
String revWord = "";
for(int i=0;i < word.length();i++){
char ch = word.charAt(i);
revWord = ch + revWord;
}
System.out.println("Original word: "+word);
System.out.println("Reversed word: "+revWord);
}
}
khanmansoor
Feb 19, '14
Log in to your account to answer this questions.