Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ejerciciosClaseJudy;
- import java.util.Scanner;
- public class Memorizar {
- public static void main(String[] args) {
- Scanner tecl = new Scanner(System.in);
- //System.out.println("digite numero de muestras ");
- int vece=tecl.nextInt();
- int taman=vece;
- int h=0;
- int preg=0;
- int[] arrego = new int[taman];
- while(vece!=0){
- for (int i=0;i < taman;i++){
- h = tecl.nextInt();
- arrego[i]=h;
- vece--;
- }
- }
- int numerop=0;
- //System.out.println("digite numero de preguntas ");
- preg = tecl.nextInt();
- for(int t=0;t < preg;t++){
- //System.out.println("digite numero que busca cuantas veces esta ");
- numerop = tecl.nextInt();
- int conta=0;
- for (int h1=0;h1 < arrego.length;h1++){
- if (numerop==arrego[h1]){
- conta=conta+1;
- //System.out.println("si esta ");
- //System.out.println(arrego[h1]);
- }
- }
- if(conta>=1){
- System.out.println(conta);
- }
- else{
- System.out.println("NOT PRESENT");
- }
- }
- tecl.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement