Advertisement
deyanmalinov

09. Palindrome Integers

Feb 22nd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package com.company;
  2. import java.util.*;
  3. public class Main {
  4.         public static void main(String[] args) {
  5.             Scanner scan = new Scanner(System.in);
  6.             String line = "";
  7.             while (true){
  8.  
  9.                 line = scan.nextLine();
  10.                 if (line.equals("END")){
  11.                     break;
  12.                 }
  13.                 for (int i = 0; i <= line.length()/2; i++) {
  14.                     int lenth = line.length();
  15.  
  16.                     if (line.charAt(i) == line.charAt(lenth-1)){
  17.                         lenth--;
  18.                         System.out.println(true);
  19.                         break;
  20.                     }else {
  21.                         System.out.println(false);
  22.                         break;
  23.                     }
  24.                 }
  25.  
  26.             }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement