Fixed typo in Lab2

This commit is contained in:
BadOfficer 2023-02-21 20:15:21 +02:00
parent 86e06c3a5a
commit 0ba52b8eaf
1 changed files with 3 additions and 3 deletions

View File

@ -44,16 +44,16 @@ public class Lab2 {
for (byte i = 0; i < matrixC.length; i++) { for (byte i = 0; i < matrixC.length; i++) {
byte largest = Byte.MIN_VALUE; // variable for largest element byte largest = Byte.MIN_VALUE; // variable for largest element
byte lowest = Byte.MAX_VALUE;// variable for smallest element byte smallest = Byte.MAX_VALUE;// variable for smallest element
for (byte j = 0; j < matrixC[i].length; j++) { for (byte j = 0; j < matrixC[i].length; j++) {
if (i % 2 == 0) { if (i % 2 == 0) {
lowest = (byte) Math.min(lowest, matrixC[i][j]); smallest = (byte) Math.min(smallest, matrixC[i][j]);
} else { } else {
largest = (byte) Math.max(largest, matrixC[i][j]); largest = (byte) Math.max(largest, matrixC[i][j]);
} }
} }
if (i % 2 == 0) { if (i % 2 == 0) {
oddSum += lowest; oddSum += smallest;
} else { } else {
evenSum += largest; evenSum += largest;
} }