El mayor de tres números
/*
* Created on 06/11/2005
*
*/
package estructura;
/**
*
* @author vns
*/
public class Mayor3 {
/**
*
*/
public Mayor3() {
super();
}
public static void main(String[] args) {
if (args.length == 0 || args.length > 3){
System.out.println("Escriba un tres números, ejemplo: 1 2 3");
System.exit(0);
}
int max = Integer.parseInt( args[0] );
for (int i = 1; i <= 2 ; i++ ){
if ( max < Integer.parseInt( args[i] ) ) {
max = Integer.parseInt( args[i] );
}
}
System.out.println("El número mayor es " + max );
}
}
* Created on 06/11/2005
*
*/
package estructura;
/**
*
* @author vns
*/
public class Mayor3 {
/**
*
*/
public Mayor3() {
super();
}
public static void main(String[] args) {
if (args.length == 0 || args.length > 3){
System.out.println("Escriba un tres números, ejemplo: 1 2 3");
System.exit(0);
}
int max = Integer.parseInt( args[0] );
for (int i = 1; i <= 2 ; i++ ){
if ( max < Integer.parseInt( args[i] ) ) {
max = Integer.parseInt( args[i] );
}
}
System.out.println("El número mayor es " + max );
}
}
0 Comments:
Post a Comment
<< Home