-
Lenguaje
Java usando JOptionPane
-
Descripción
Obtiene el mayor de 5 números.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import javax.swing.JOptionPane;
public class MayorDe5Numeros {
public static void main (String[] args) {
int i;
double mayor, un_numero;
mayor = 0;
for (i=1; i<=5; i++) {
JOptionPane.showMessageDialog(null, "PROCESO " + i);
un_numero = Double.parseDouble(JOptionPane.showInputDialog("Ingresa el valor de un numero"));
if(i==1||mayor<un_numero)
mayor=un_numero;
}
JOptionPane.showMessageDialog(null,
"Valor de mayor: " + mayor);
}
}
public class MayorDe5Numeros {
public static void main (String[] args) {
int i;
double mayor, un_numero;
mayor = 0;
for (i=1; i<=5; i++) {
JOptionPane.showMessageDialog(null, "PROCESO " + i);
un_numero = Double.parseDouble(JOptionPane.showInputDialog("Ingresa el valor de un numero"));
if(i==1||mayor<un_numero)
mayor=un_numero;
}
JOptionPane.showMessageDialog(null,
"Valor de mayor: " + mayor);
}
}