Skip to content

Instantly share code, notes, and snippets.

@titandiaz
Created April 4, 2016 04:49
Show Gist options
  • Save titandiaz/342b3d644b096295d48fed227b430d96 to your computer and use it in GitHub Desktop.
Save titandiaz/342b3d644b096295d48fed227b430d96 to your computer and use it in GitHub Desktop.
Con una nota escrita saber que posición tiene esa nota en el array
package arrays;
import java.util.Scanner;
public class arrayEjercicioUno {
public static void main(String[] args) {
double[] notas = {2.8, 4.6, 3.8, 3.7, 3.5, 1.2, 4.7};
Scanner leer=new Scanner(System.in);
int i;
double nota;
System.out.println("Digite el valor de la nota ");
nota=leer.nextDouble();
for(i=0; i<7; i++)
{
if(nota == notas[i])
System.out.println("La posicion de la nota es: " + i + " ");
}
for(i=0; i != notas[i] ; i++){
System.out.println("la posicion no existe");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment