RcrdBrt

Untitled

Nov 10th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Es5 {
  3. public static void main(String[] args) {
  4. Scanner kb = new Scanner(System.in);
  5. String stringa = kb.next();
  6. boolean b = true;
  7. for (int i = 0, j = stringa.length() - 1; i < j && b; i++, j--) {
  8. if (stringa.charAt(i) != stringa.charAt(j)) {
  9. System.out.println(stringa + " non e' palindroma");
  10. b=false;
  11. }
  12. }
  13. System.out.println(stringa + " e' palindroma");
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment