bug fixes in Lab1

This commit is contained in:
BadOfficer 2023-02-23 22:37:33 +02:00
parent 71baf63a21
commit 4fce8c914c
1 changed files with 6 additions and 1 deletions

View File

@ -21,10 +21,15 @@ public class Lab1 {
int m = scan.nextInt();// Entering m
scan.close();
if (a >= n || b >= m || a <= -c && n >= -c || b <= 0 && m >= 0) {
if (a <= -c && n >= -c || b <= 0 && m >= 0) {
System.out.println("Error! Division by zero");
return;
}
else if(a > n || b > m){
result = 0;
System.out.println(result);
return;
}
for (short i = (short) a; i <= n; i++) {
for (short j = (short) b; j <= m; j++) {