Created
October 18, 2015 20:19
-
-
Save StrixG/88714de5b7a4ff6b3f03 to your computer and use it in GitHub Desktop.
Задача №65. Количество положительных элементов
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
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