VECTOR
import javax.swing.JOptionPane;
public class Vectores3 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int s=0;
int n =Integer.parseInt(JOptionPane.showInputDialog("digite la cantidad de numeros que desea ingresar"));
int []numero=new int [n];
for (int i=0;i JOptionPane.showMessageDialog(null, " digite el numero "+String.valueOf(i));
numero[i]=Integer.parseInt(JOptionPane.showInputDialog("digite el numero"));
s=(s+numero[i]);
}
for (int i=0;i
JOptionPane.showMessageDialog(null, " "+String.valueOf(numero[i]));
}
JOptionPane.showMessageDialog(null, " = "+String.valueOf(s));
}
}
public class Vectores3 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int s=0;
int n =Integer.parseInt(JOptionPane.showInputDialog("digite la cantidad de numeros que desea ingresar"));
int []numero=new int [n];
for (int i=0;i
numero[i]=Integer.parseInt(JOptionPane.showInputDialog("digite el numero"));
s=(s+numero[i]);
}
for (int i=0;i
JOptionPane.showMessageDialog(null, " "+String.valueOf(numero[i]));
}
JOptionPane.showMessageDialog(null, " = "+String.valueOf(s));
}
}
Comentarios
Publicar un comentario