diff --git a/serie1/Tableau.java b/serie1/Tableau.java new file mode 100644 index 0000000000000000000000000000000000000000..b42789d38d063e33810c5c8c800bc1d3c934d193 --- /dev/null +++ b/serie1/Tableau.java @@ -0,0 +1,25 @@ +public class Tableau { + + public static int countPositive(double[][] mat) { + int res = 0; + for (int i = 0; i < mat.length; i++) { + for (int j = 0; j < mat[i].length; j++) { + if (mat[i][j] > 0.0) { + res++; + } + } + } + return res; + } + + public static void main(String[] args) { + double[][] example = { + { 1.0, -2.0 }, + { 3.0 }, + { 1.5, -2.5, 3.0 } + }; + + int res = countPositive(example); + System.out.println("Count: " + res); + } +}