Advertisement
santiagol26

MEMORIZAR

Oct 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package ejerciciosClaseJudy;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Memorizar {
  6.  
  7. public static void main(String[] args) {
  8. Scanner tecl = new Scanner(System.in);
  9. //System.out.println("digite numero de muestras ");
  10. int vece=tecl.nextInt();
  11. int taman=vece;
  12. int h=0;
  13. int preg=0;
  14. int[] arrego = new int[taman];
  15. while(vece!=0){
  16. for (int i=0;i < taman;i++){
  17. h = tecl.nextInt();
  18. arrego[i]=h;
  19. vece--;
  20. }
  21. }
  22. int numerop=0;
  23. //System.out.println("digite numero de preguntas ");
  24. preg = tecl.nextInt();
  25. for(int t=0;t < preg;t++){
  26.  
  27. //System.out.println("digite numero que busca cuantas veces esta ");
  28. numerop = tecl.nextInt();
  29. int conta=0;
  30. for (int h1=0;h1 < arrego.length;h1++){
  31. if (numerop==arrego[h1]){
  32. conta=conta+1;
  33. //System.out.println("si esta ");
  34. //System.out.println(arrego[h1]);
  35. }
  36. }
  37. if(conta>=1){
  38. System.out.println(conta);
  39. }
  40. else{
  41. System.out.println("NOT PRESENT");
  42. }
  43. }
  44. tecl.close();
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement