From 4fce8c914c25217c0eaabc45be4f9574c4f0932a Mon Sep 17 00:00:00 2001 From: BadOfficer Date: Thu, 23 Feb 2023 22:37:33 +0200 Subject: [PATCH] bug fixes in Lab1 --- src/IO_24/_02_Бондаренко_Тарас_Андрійович/lab1/Lab1.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/IO_24/_02_Бондаренко_Тарас_Андрійович/lab1/Lab1.java b/src/IO_24/_02_Бондаренко_Тарас_Андрійович/lab1/Lab1.java index 79aebe1..f065dea 100644 --- a/src/IO_24/_02_Бондаренко_Тарас_Андрійович/lab1/Lab1.java +++ b/src/IO_24/_02_Бондаренко_Тарас_Андрійович/lab1/Lab1.java @@ -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++) {