Previous Next
0 / 21
Module DEMO-32-109DEMO-C-32

Count Positive

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program to count how many positive numbers exist in an N x M matrix.

Constraints

1 <= N, M <= 10. Integers within standard range.

Input Format

Input: Dimensions N M followed by the matrix elements.

Output Format

Output: The formatted result as specified.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
2 2
30 41
-2 39
3
Found 3 positive numbers in 2x2 matrix.
Sample #2
Public sample
4 5
-9 31 22 22 44
27 28 -2 7 16
18 28 -8 8 27
14 -6 19 0 22
15
Found 15 positive numbers in 4x5 matrix.
Sample #3
Public sample
4 5
0 -7 10 15 43
18 20 37 5 -1
24 35 33 48 28
37 23 8 -8 -7
15
Found 15 positive numbers in 4x5 matrix.
Sample #4
Public sample
5 5
39 6 16 45 48
37 49 14 36 27
15 -8 -9 47 31
39 40 37 17 -3
3 -7 14 40 17
21
Found 21 positive numbers in 5x5 matrix.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings