Publicidad
Publicidad

Más contenido relacionado

Publicidad

Programa 23

  1. Programa 23 Nombre: Javier Alejandro León Avalos Grado y grupo: 3°G Especialidad: Programación
  2. Descripción del programa • Programa en el cual se declaran, se les da valor e imprime Arreglos
  3. Código • package arreglos; • import javax.swing.JOptionPane; • public class Ejercicio1 { • public static void ArreglosUnidimensionales() { int n; • n=Integer.parseInt(JOptionPane.showInputDialog(null," ESCRIBE ELTAMAÑO DEL ARREGLO ")); • int Arreglo[]=new int[n]; • for(int i=0;i<n;i++){ • Arreglo[i] = Integer.parseInt(JOptionPane.showInputDialog(null," INGRESA ELVALOR " + " DEL ELEMENTOARREGLO[" + i + "]")); • } • for(int i=0;i<n;i++){ • Object msj = "ARREGLO [" + i + "]=" + Arreglo[i]; • JOptionPane.showMessageDialog(null, msj, "SALIDA", JOptionPane.PLAIN_MESSAGE); • System.out.println("ARREGLO[" + i + "]=" + Arreglo[i]);}} • public static void main(String[] args) { • ArreglosUnidimensionales(); • }}
  4. Prueba de escritorio
  5. Conclusiones • Este programa nos ayuda a entender sobre los arreglos y como ustilizarlos
Publicidad