-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTasksEolimp.java
More file actions
54 lines (46 loc) · 1.38 KB
/
TasksEolimp.java
File metadata and controls
54 lines (46 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//задача: умовний оператор - 1
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int x = console.nextInt();
int y;
if (x<5) {
y = x*x - 3*x+4;
} else {
y = x+7;
}
System.out.print(y);
}
}
//задача: прямокутник
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
while (console.hasNextInt()) {
int n = console.nextInt();
int m = console.nextInt();
int perimeter = 2 * (n + m);
int area = n * m;
System.out.println(perimeter + " " + area);
}
console.close();
}
//задача: вивести масив 2
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int n = console.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = console.nextInt();
}
System.out.print(arr[n - 1]);
for (int i = n - 2; i >= 0; i--) {
System.out.print(" " + arr[i]);
}
console.close();
}
}