Documentos de Académico
Documentos de Profesional
Documentos de Cultura
JOptionPane; /* * To change this template, choose Tools | Templates * and open the template in the editor. */
/** * * @author mayoveg@ */ public class sumadieznumeros { public static void main(String args[]) { int n1,n2,n3,n4,n5,n6,n7,n8,n9,n10; n1 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 1er. numero")); n2 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 2do. numero")); n3 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 3er. numero")); n4 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 4to.numero")); n5 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 5to. numero")); n6 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 6to. numero")); n7 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 7mo. numero")); n8 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 8vo. numero")); n9 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 9no. numero")); n10 = Integer.parseInt(JOptionPane.showInputDialog("Escribe 10mo. numero"));
int r= n1+n2+n3+n4+n5+n6+n7+n8+n9+n10;
LISTA DE ALUMNOS import javax.swing.JOptionPane; /* * To change this template, choose Tools | Templates
public static void main(String args[]) { int num=0; int i; num = Integer.parseInt(JOptionPane.showInputDialog("Dame edad")); for (i=0; i<=num;i++) { num = Integer.parseInt(JOptionPane.showInputDialog("Dame edad"));
TABLA DE SUMAR import javax.swing.JOptionPane; /** * * @author mayoveg@ */ public class tabladesumar { public static void main (String[] args) { int i; int tabla=0; /*solicita y el dato y se puede inter actuar con la informacion */ tabla = Integer.parseInt(JOptionPane.showInputDialog("Escribe un nmero: "));
}} } BURBUJA DE CINCO NUMEROS import javax.swing.JOptionPane; /** * * @author mayoveg@ */ public class burbujacinconumeros { public static void main(String[] ar) { double arreglo[] = { 30, 49, 7, 76, 12,}; for (int i = arreglo.length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (arreglo[j] > arreglo[j + 1]) { double temp = arreglo[j]; arreglo[j] = arreglo[j + 1]; arreglo[j + 1] = temp; } } } for (int i = 0; i < arreglo.length; i++) { System.out.println(arreglo[i]); } } }