Skip to content

Instantly share code, notes, and snippets.

@StrixG
Created October 18, 2015 20:19
Show Gist options
  • Save StrixG/88714de5b7a4ff6b3f03 to your computer and use it in GitHub Desktop.
Save StrixG/88714de5b7a4ff6b3f03 to your computer and use it in GitHub Desktop.
Задача №65. Количество положительных элементов
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] array = new int[in.nextInt()];
for (int i = 0; i < array.length; i++) {
array[i] = in.nextInt();
}
int positiveCount = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] > 0) {
positiveCount++;
}
}
System.out.println(positiveCount);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment