Skip to content

Instantly share code, notes, and snippets.

@romec512
Created July 2, 2019 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romec512/842c8eaf26705b14857c112150ffaf6d to your computer and use it in GitHub Desktop.
Save romec512/842c8eaf26705b14857c112150ffaf6d to your computer and use it in GitHub Desktop.
test
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