* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ejercicio4;
import Ejercicio1.Cola;
import java.util.Scanner;
/**
*
* @author l9531
*/
public class Invertir {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
Cola<Integer> cola=new Cola();
System.out.println("Ingrese numero");
int numero=sc.nextInt();
int con=numero;
while(numero!=0){
cola.encolar(numero%10);
numero=numero/10;
}
System.out.println("numero palindrome ");
while(con!=0){
int c=cola.desencolar();
System.out.println(c);
numero=numero/10;
}
}
}
0 comentarios:
Publicar un comentario