Ayuda por favor, código java
Publicado por Marcos (5 intervenciones) el 31/08/2019 21:14:38
Hola necesito ayuda con esto, el contador ( cont ) no sube de 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Scanner teclado=new Scanner(System.in);
System.out.println("Ingrese su Nombre");
String Nombre=teclado.nextLine();
System.out.println("Ingrese su Cédula de Identidad");
String ci=teclado.nextLine();
int a[]={1,2,3,4};
int pos=0;
int cant=0;
boolean esta=false;
System.out.println("Ingrese 5 números");
for (int i=0;i<a.length + 1;i++){
System.out.println("Ingrese el número " + (i+1) );
int nro = teclado.nextInt();
while (pos<a.length){
esta=false;
if (a[pos]==nro){esta=true;}
if (a[pos]!=nro){esta=false;}
if (esta){cant++;}
pos++;
}
}
System.out.println("La cantidad es " + cant);
}
}
Valora esta pregunta


0