Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Contrario {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- String nome;
- int a=0;
- System.out.println("inserisci parola");
- nome=input.nextLine();
- input.close();
- for(int i=0; i<=nome.length()/2; i++){
- if(nome.charAt(i)==nome.charAt(nome.length()-i-1)){
- }
- else{
- a=1;
- }
- }
- if(a==0)
- System.out.println("è palindromo");
- else
- System.out.println("non è palindromo");
- }
- }
Add Comment
Please, Sign In to add comment