Advertisement
Shavit

P. 17 Ex. 9.12

Dec 27th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. // Shavit Borisov
  2. // CW
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class ReversedString {
  7.  
  8.     public static void main(String[] args)
  9.    
  10.     {
  11.         Scanner in = new Scanner (System.in);
  12.        
  13.         String input;
  14.        
  15.         System.out.print("Enter a string: ");
  16.         input = in.nextLine();
  17.        
  18.         System.out.print("Your reversed string is:\n");
  19.        
  20.         for(int i = (input.length() - 1); i >= 0; i--)
  21.             System.out.printf("%c", input.charAt(i));
  22.        
  23.         in.close();
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement