mirror of
https://github.com/ASDjonok/OOP_IO-2x_2023.git
synced 2026-04-20 04:51:51 +03:00
Moved folders.
This commit is contained in:
BIN
Java/Lab 1/Lab_1.class
Normal file
BIN
Java/Lab 1/Lab_1.class
Normal file
Binary file not shown.
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user