Mi tarea a realizar es la siguiente: hacer un programa en donde se pidan numeros hasta que se teclee uno negativo y mostrar cuantos numeros se han introducido.
El código que yo ejecute es el siguiente:
public static void main(String[] args) {
int a,b,c,d;
a=Integer.parseInt(JOptionPane.showInputDialog("Digite un numero"));
b=Integer.parseInt(JOptionPane.showInputDialog("Digite otro numero"));
c=Integer.parseInt(JOptionPane.showInputDialog("Digite otro numero"));
d=Integer.parseInt(JOptionPane.showInputDialog("Digite otro numero"));
if(a>0&&b>0){
if(c>0&&d>0){
JOptionPane.showMessageDialog(null,"Acontinuacion el listado de los
numeros que
digitaste:\n"
+a+"\n"+b+"\n"+c+"\n"+d);
}
}
}
}