MCPcopy Create free account
hub / github.com/Hazrat-Ali9/Computer-Programming / main

Method main

Problem1.java:7–30  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

5public class Problem1 {
6
7 public static void main(String[] args) {
8 // TODO Auto-generated method stub
9 Scanner scan = new Scanner(System.in);
10 int numberCount, negativeCount = 0, positiveCount = 0;
11 int[] n;
12
13 numberCount = scan.nextInt();
14 n = new int[numberCount];
15
16 for (int i = 0; i < n.length; i++) {
17 n[i] = scan.nextInt();
18 }
19 scan.close();
20
21 for (int i = 0; i < n.length; i++) {
22 if (n[i] < 0) {
23 negativeCount++;
24 } else {
25 positiveCount++;
26 }
27 }
28
29 System.out.printf("%d %d", positiveCount, negativeCount);
30 }
31
32}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected