Created
July 2, 2019 06:42
-
-
Save romec512/842c8eaf26705b14857c112150ffaf6d to your computer and use it in GitHub Desktop.
test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int [] mass = {10, 2, 3, 3, 4, 1, 1, 1, 2, 6}; | |
int [] quantity = {1, 2, 3, 4, 5}; | |
int [] results = {0, 0, 0, 0, 0}; | |
for (int i = 0; i < mass.length; i++) { | |
for (int j = 0; j < quantity.length; j++) { | |
if (mass[i] == quantity[j]) { | |
results[j]++; | |
break; //Зачем break тут? | |
} | |
} | |
} | |
for (int i = 0; i < results.length; i++) { | |
System.out.println(i + 1 + " - кол-во элементов последовательности: " + results[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment