Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1
- 2
- 1
- 2
- 2
- 2
- 4
- 4
- 4
- 3
- 3
- 3
- 2
- 1
- 1
- 3
- 3
- 3
- 4
- 4
- 4
- 1
- 1
- -1
- ДВОЕК - 5
- ЕДИНИЧЕК - 6
- 1 ... 100
- /**
- int count1 = 0;
- int count2 = 0;
- int count3 = 0;
- int count4 = 0;
- **/
- int array[] = new int[100];
- int current = scanner.nextInt();
- while (current > 0) {
- array[current]++;
- /**
- if (current == 4) {
- count4++;
- }
- if (current == 3) {
- count3++;
- }
- else if (current == 2) {
- count2++;
- } else if (current == 1) {
- count1++;
- }
- **/
- current = scanner.nextInt();
- }
- // array -> MAX -> индекс X, значение Y, array[10] == 35
- System.out.println(count2);
- System.out.println(count1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement