Compare commits

..

7 Commits

Author SHA1 Message Date
8100129706 Ceanup. 2023-05-02 11:42:37 +03:00
83d98b2982 Merge branch 'ІО-23/30-Швед-Андрій-Дмитрович' of https://github.com/ASDjonok/OOP_IO-2x_2023 into ІО-23/30-Швед-Андрій-Дмитрович 2023-05-02 11:40:28 +03:00
4af0ab5655 . 2023-05-02 11:38:55 +03:00
Rhinemann
07e9fbdc88 Delete Lab_2.class 2023-05-02 11:35:28 +03:00
Rhinemann
41aaaf4623 Delete Lab_1.class 2023-05-02 11:35:16 +03:00
99e9428dba Moved folders. 2023-05-02 11:34:34 +03:00
fe36219746 Update Lab 1. 2023-05-02 09:58:31 +03:00
5 changed files with 67 additions and 43 deletions

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
Lab 1/Lab_1.class
Lab 2/Lab_2.class

64
Java/Lab 1/Lab_1.java Normal file
View File

@@ -0,0 +1,64 @@
import java.util.Scanner;
public class Lab_1 {
public static void main(String[] args) {
int n, m, a, b;
float s = 0;
Scanner input = new Scanner(System.in);
do {
try {
System.out.print("Enter n: ");
n = input.nextInt();
break;
} catch (Exception e) {
System.out.println("N must be an integer.");
input.nextLine();
}
} while (true);
do {
try {
System.out.print("Enter m: ");
m = input.nextInt();
break;
} catch (Exception e) {
System.out.println("M must be an integer.");
input.nextLine();
}
} while (true);
do {
try {
System.out.print("Enter a: ");
a = input.nextInt();
break;
} catch (Exception e) {
System.out.println("A must be an integer.");
input.nextLine();
}
} while (true);
do {
try {
System.out.print("Enter b: ");
b = input.nextInt();
break;
} catch (Exception e) {
System.out.println("B must be an integer.");
input.nextLine();
}
} while (true);
input.close();
for (int i = a; i <= n; i++) {
for (int j = b; j <= m; j++) {
s += j;
}
}
System.out.println("S = " + s);
}
}

View File

@@ -1,41 +0,0 @@
import java.util.Scanner;
public class Lab_1 {
public static void main(String[] args) {
int n, m, a, b;
float s = 0;
Scanner input = new Scanner(System.in);
System.out.print("Enter n: ");
n = input.nextInt();
System.out.print("Enter m: ");
m = input.nextInt();
do {
System.out.print("Enter a (can't be above n): ");
a = input.nextInt();
} while (a > n);
do {
System.out.print("Enter b (can't be above m): ");
b = input.nextInt();
} while (b > m);
input.close();
if ((a <= 0) && (n >= 0)) {
System.out.println("Error, division by zero, shutting down!");
System.exit(1);
}
for (int i = a; i < n; i++) {
for (int j = b; j < m; j++) {
s += i * j / i;
}
}
System.out.println("S = " + s);
}
}

3
Rust/Lab 1/Lab_1.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
}