Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //melinda
- //1.12.16
- import java.util.*;
- public class ForLoopyString
- {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- System.out.print("Enter a word: ");
- String word = input.nextLine();
- int length=word.length();
- System.out.println(word.charAt(0));
- System.out.println(word.charAt(length-1));
- for(int i = length; i>=1; i--){
- System.out.print(word.charAt(i-1));
- }
- System.out.println("\n"+word);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement