I have developed this program and it works well, however it does not coordinate the cycle Do...While
That is, I need that once given (the number inverted), I continue to print the same question, in order to keep repeating the cycle, until finally when you assign the value 0, the program ends correctly.
import javax.swing.JOptionPane;
public class MetodoParaInvertir {
public static void main(String[] args) {
int num, n, resultado=0;
num= Integer.parseInt(JOptionPane.showInputDialog("Ingrese un numero entero: "));
System.out.println ("El numero ingresado es : "+num);
do {
n = num % 10;
num = num / 10;
resultado = resultado * 10 + n;
} while (num != 0);
System.out.println (" \nY su reves es: " +resultado);
if ( resultado >0 ) {
num= Integer.parseInt(JOptionPane.showInputDialog("Ingrese Nuevamente Un Numero: "));
System.out.println ("El numero ingresado es : "+num);
System.out.println (" \nSu reves es: " +resultado);
}
if (resultado <0) {
System.out.println (" \nFin del ciclo! ");
}
}
}