Advertisement
Marin126

Ex01Ej02

Dec 3rd, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1.  
  2. package com.mycompany.examen;
  3.  
  4. import java.util.Scanner;
  5.  
  6. /**
  7. *
  8. * @author anton
  9. */
  10. public class Ejercicio02 {
  11.  
  12. public static void main(String[] args) {
  13. Scanner sc = new Scanner(System.in);
  14.  
  15. System.out.println("Introduce una palabra");
  16. String entrada = sc.nextLine();
  17. String input[];
  18. String salida = "";
  19.  
  20. for (int i = 0; i < entrada.length(); i++) {
  21. salida = entrada.charAt(i) + salida;
  22.  
  23. }
  24. if (entrada.equals(salida)) {
  25. System.out.println("Si");
  26.  
  27. } else {
  28. System.out.println("No");
  29. }
  30.  
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement