Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. 1
  2. 2
  3. 1
  4. 2
  5. 2
  6. 2
  7. 4
  8. 4
  9. 4
  10. 3
  11. 3
  12. 3
  13. 2
  14. 1
  15. 1
  16. 3
  17. 3
  18. 3
  19. 4
  20. 4
  21. 4
  22. 1
  23. 1
  24. -1
  25.  
  26. ДВОЕК - 5
  27. ЕДИНИЧЕК - 6
  28.  
  29. 1 ... 100
  30. /**
  31. int count1 = 0;
  32. int count2 = 0;
  33. int count3 = 0;
  34. int count4 = 0;
  35. **/
  36. int array[] = new int[100];
  37.  
  38. int current = scanner.nextInt();
  39. while (current > 0) {
  40.     array[current]++;
  41.     /**
  42.     if (current == 4) {
  43.         count4++;
  44.     }
  45.     if (current == 3) {
  46.         count3++;
  47.     }
  48.     else if (current == 2) {
  49.         count2++;
  50.     } else if (current == 1) {
  51.         count1++;
  52.     }
  53.     **/
  54.     current = scanner.nextInt();
  55. }
  56.  
  57. // array -> MAX -> индекс X, значение Y, array[10] == 35
  58.  
  59. System.out.println(count2);
  60. System.out.println(count1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement