diff --git a/lab1/FunctionCalculator/.idea/.gitignore b/lab1/FunctionCalculator/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/lab1/FunctionCalculator/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/lab1/FunctionCalculator/.idea/.name b/lab1/FunctionCalculator/.idea/.name
new file mode 100644
index 0000000..002da1d
--- /dev/null
+++ b/lab1/FunctionCalculator/.idea/.name
@@ -0,0 +1 @@
+Main.java
\ No newline at end of file
diff --git a/lab1/FunctionCalculator/.idea/misc.xml b/lab1/FunctionCalculator/.idea/misc.xml
new file mode 100644
index 0000000..7464918
--- /dev/null
+++ b/lab1/FunctionCalculator/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab1/FunctionCalculator/.idea/modules.xml b/lab1/FunctionCalculator/.idea/modules.xml
new file mode 100644
index 0000000..5092df8
--- /dev/null
+++ b/lab1/FunctionCalculator/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab1/FunctionCalculator/FunctionCalculator.iml b/lab1/FunctionCalculator/FunctionCalculator.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/lab1/FunctionCalculator/FunctionCalculator.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab1/FunctionCalculator/out/production/FunctionCalculator/Main.class b/lab1/FunctionCalculator/out/production/FunctionCalculator/Main.class
new file mode 100644
index 0000000..920cbb0
Binary files /dev/null and b/lab1/FunctionCalculator/out/production/FunctionCalculator/Main.class differ
diff --git a/lab1/FunctionCalculator/src/Main.java b/lab1/FunctionCalculator/src/Main.java
new file mode 100644
index 0000000..bcda6ea
--- /dev/null
+++ b/lab1/FunctionCalculator/src/Main.java
@@ -0,0 +1,51 @@
+import java.util.Scanner;
+public class Main {
+ public static void main(String[] args) {
+ //C2 = 2501 % 2 = 1, і операція O1 буде відніманням (-).
+ //C3 = 2501 % 3 = 2
+ //C5 = 2501 % 5 = 1, і операція O2 буде діленням (/).
+ //C7 = 2501 % 7 = 4, тип індексів i та j буде char.
+ double result = 0; // результат
+ char i, j;
+ char operation1 = '-';
+ double constant = 2.0;
+ Scanner scanner = new Scanner(System.in);
+ System.out.print("Введіть значення n: ");
+ int n = scanner.nextInt();
+ System.out.print("Введіть значення m: ");
+ int m = scanner.nextInt();
+
+ // Обчислення значення функції S
+ for (i = 'a'; i <= 'a' + n - 1; i++) {
+ for (j = 'b'; j <= 'b' + m - 1; j++) {
+ try {
+ double value = (double) i / applyOperation(j, operation1, constant);
+ result += value;
+ } catch (ArithmeticException e) {
+ System.out.println("Ділення на нуль: " + e.getMessage());
+ } catch (Exception e) {
+ System.out.println("Виникла помилка: " + e.getMessage());
+ }
+ }
+ }
+
+ // Виведення результату
+ System.out.println("Результат: " + result);
+ }
+
+ // Метод, який застосовує операцію О1 до двох чисел
+ public static double applyOperation(char j, char operation, double constant) throws Exception {
+ switch (operation) {
+ case '-':
+ return (double) j - constant;
+ case '/':
+ if (constant == 0.0) {
+ throw new ArithmeticException("C не може бути рівним нулю");
+ } else {
+ return (double) j / constant;
+ }
+ default:
+ throw new Exception("Непідтримувана операція: " + operation);
+ }
+ }
+}
\ No newline at end of file
diff --git a/lab1/lab1.pdf b/lab1/lab1.pdf
new file mode 100644
index 0000000..3c875e7
Binary files /dev/null and b/lab1/lab1.pdf differ