mirror of
https://github.com/ASDjonok/OOP_IO-2x_2023.git
synced 2025-06-08 14:59:24 +03:00
Compare commits
7 Commits
896fc1f4d4
...
8100129706
Author | SHA1 | Date | |
---|---|---|---|
8100129706 | |||
83d98b2982 | |||
4af0ab5655 | |||
|
07e9fbdc88 | ||
|
41aaaf4623 | ||
99e9428dba | |||
fe36219746 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
Lab 1/Lab_1.class
|
||||
Lab 2/Lab_2.class
|
64
Java/Lab 1/Lab_1.java
Normal file
64
Java/Lab 1/Lab_1.java
Normal 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);
|
||||
}
|
||||
}
|
@ -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
3
Rust/Lab 1/Lab_1.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user