Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mport java.util.Scanner;
- public class ZiolkowskiKyleA2Q2 {
- public static void main(String[] args)
- {
- //declare variables
- //String input; // to store the users input
- String input;
- int first;
- int last;
- char charFirst; // to store the first char
- char charLast; // to store the last char
- Scanner kbd = new Scanner(System.in);
- System.out.println("Enter in a palindrome of your choice");
- input = kbd.nextLine();
- first = 0;
- last = input.length() -1;
- while (first < last) {
- charFirst = input.charAt(first);
- charLast = input.charAt(first);
- if (charFirst == charLast) {
- System.out.println(input + " : is a palindrome");
- }
- else {
- System.out.println(input + " :is not a palindrome");
- }
- System.out.println("***End of Programming***");
- }
- }
- }
Add Comment
Please, Sign In to add comment