mirror of
https://github.com/ASDjonok/OOP_IO-2x_2023.git
synced 2026-04-01 21:21:50 +03:00
Add files via upload
This commit is contained in:
20
lab1/src/Main.java
Normal file
20
lab1/src/Main.java
Normal file
@@ -0,0 +1,20 @@
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
float s = 0, a = 2, b = 1, m = 6, n = 4;
|
||||
|
||||
for (float i = a; i <= m; i++) {
|
||||
for (float j = b; j <= n; j++) {
|
||||
// Перевірка ділення на 0.
|
||||
if (i == -1) {
|
||||
System.out.println("Помилка: ділення на нуль не можливе.");
|
||||
return;
|
||||
}
|
||||
s += (i + j) / (i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("S = " + s);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user