Arreglo
public class Main {
/**
* @param args the command line arguments
*/
public static void funcion9 (){
Integer[] numeros=new Integer[10];
try {
numeros[0] = System.in.read();
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println( numeros[0]);
}
public static void funcion2 (){
Integer[] numeros=new Integer[10];
try {
numeros[0]=0;
for(int i=0; i<10; i++){
if(i>0){
numeros[i] = System.in.read();
}
if(numeros[i]==10){
i--;
}
else{
System.out.println("Ingrese el numero " +i);
}
}
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
Integer mayor=0;
for(int i=0; i<10; i++){
if(mayor<numeros[i]){
mayor=numeros[i];
}
}
System.out.println(mayor-48);
}
public static void main(String[] args) {
funcion9();
// TODO code application logic here
}
}
No hay comentarios:
Publicar un comentario