PROBLEMA BASICO
Publicado por FELIPe (27 intervenciones) el 11/08/2008 21:58:24
hola tengo que hacer un programa que lea primero cuantos numeros hay luego de esos números cual es el menor varias veces pero:
1 no se como darle a una función por parametro un arreglo y
2. no se porque no me sirve el while que tengo para leer los numeros hasta que haya un 0
Este es el codigo que tengo:
public class ValoresExtremos {
public static void main(String[] args) throws Exception{
int x, y=0, z;
int arr2[]= new int [20];
int arr []= new int [20];
int valor;
Scanner in = new Scanner(new File("extremos"));
x=in.nextInt();
//while (x!=0){
for (y=0;y<x;y++){
arr[y]= in.nextInt();
}
x=in.nextInt();
valor= valormenor(arr);
//}
for (y=0;y<=x;y++){
System.out.println(arr[y]);
}
}
public static int valormenor(int arr){
for (int x=0; x<arr; x++){
}
}
}
1 no se como darle a una función por parametro un arreglo y
2. no se porque no me sirve el while que tengo para leer los numeros hasta que haya un 0
Este es el codigo que tengo:
public class ValoresExtremos {
public static void main(String[] args) throws Exception{
int x, y=0, z;
int arr2[]= new int [20];
int arr []= new int [20];
int valor;
Scanner in = new Scanner(new File("extremos"));
x=in.nextInt();
//while (x!=0){
for (y=0;y<x;y++){
arr[y]= in.nextInt();
}
x=in.nextInt();
valor= valormenor(arr);
//}
for (y=0;y<=x;y++){
System.out.println(arr[y]);
}
}
public static int valormenor(int arr){
for (int x=0; x<arr; x++){
}
}
}
Valora esta pregunta


0