Skip to content

Commit ccd662c

Browse files
authored
Merge branch 'main' into main
2 parents 5008140 + 13bf52b commit ccd662c

File tree

199 files changed

+4905
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+4905
-3
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<module>students/23K0368</module>
3737
<module>students/23K0754</module>
3838
<module>students/24K0458</module>
39+
<module>students/23K0565</module>
3940
<module>students/23K0350</module>
4041
<module>students/23K1302</module>
4142
<module>students/23K0346</module>
@@ -44,6 +45,11 @@
4445
<module>students/23K0155</module>
4546
<module>students/23K0114</module>
4647
<module>students/23K0823</module>
48+
<module>students/23K0087</module>
49+
<module>students/23K0112</module>
50+
<module>students/23K0351</module>
51+
<module>students/23K0563</module>
52+
<module>students/23K0116</module>
4753
</modules>
4854

4955
<dependencies>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23K0087</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0087-p01</artifactId>
12+
<description>Массивы</description>
13+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package ru.mirea.practice.s23k0087;
2+
3+
import java.util.Arrays;
4+
import java.util.Scanner;
5+
6+
7+
public abstract class Task3 {
8+
public static void main(String[] args) {
9+
int n;
10+
int[] mas;
11+
try (Scanner sc = new Scanner(System.in)) {
12+
System.out.print("Введите количество элементов массива > ");
13+
n = sc.nextInt();
14+
mas = new int[n];
15+
16+
for (int i = 0; i < mas.length; i++) {
17+
System.out.print("Введите " + (i + 1) + " элемент массива > ");
18+
mas[i] = sc.nextInt();
19+
System.out.print("\033[H\033[2J");
20+
}
21+
}
22+
System.out.println(Arrays.toString(mas));
23+
int sum = 0;
24+
25+
for (int ma : mas) {
26+
sum += ma;
27+
}
28+
29+
System.out.println("Сумма всех элементов массива: " + sum);
30+
float mean = (float) sum / mas.length;
31+
System.out.println("Среднее арифметическое всех чисел массива: " + mean);
32+
}
33+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package ru.mirea.practice.s23k0087;
2+
3+
import java.util.Scanner;
4+
5+
public abstract class Task4 {
6+
public static void main(String[] args) {
7+
int n;
8+
int[] mas;
9+
try (Scanner sc = new Scanner(System.in)) {
10+
System.out.print("Введите количество элементов массива > ");
11+
n = sc.nextInt();
12+
mas = new int[n];
13+
if (n <= 0) {
14+
System.out.println("Количество элементов массива не должно быть меньше 1");
15+
sc.close();
16+
return;
17+
}
18+
for (int i = 0; i < mas.length; i++) {
19+
System.out.print("Введите " + (i + 1) + " элемент массива > ");
20+
mas[i] = sc.nextInt();
21+
System.out.print("\033[H\033[2J");
22+
}
23+
} catch (RuntimeException e) {
24+
throw new RuntimeException(e);
25+
}
26+
int j = 0;
27+
int sum = 0;
28+
do {
29+
sum += mas[j];
30+
j++;
31+
} while (j < mas.length);
32+
System.out.println(sum);
33+
sum = 0;
34+
j = 0;
35+
while (j < mas.length) {
36+
sum += mas[j];
37+
j++;
38+
}
39+
System.out.println(sum);
40+
int min = mas[0];
41+
for (int ma : mas) {
42+
if (min > ma) {
43+
min = ma;
44+
}
45+
}
46+
System.out.println("Минимальный элемент массива: " + min);
47+
int max = mas[0];
48+
for (int ma : mas) {
49+
if (max < ma) {
50+
max = ma;
51+
}
52+
}
53+
System.out.println("Максимальный элемент массива: " + max);
54+
}
55+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package ru.mirea.practice.s23k0087;
2+
3+
public abstract class Task5 {
4+
public static void main(String[] args) {
5+
for (String arg : args) {
6+
System.out.println(arg);
7+
}
8+
}
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ru.mirea.practice.s23k0087;
2+
3+
public abstract class Task6 {
4+
public static void main(String[] args) {
5+
System.out.println("Первые 10 чисел гармонического ряда:");
6+
for (int i = 1; i <= 10; i++) {
7+
System.out.printf("1/%d = %.4f%n", i, 1.0 / i);
8+
}
9+
}
10+
11+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package ru.mirea.practice.s23k0087;
2+
3+
public abstract class Task7 {
4+
public static long factorial(int n) {
5+
if (n < 0) {
6+
throw new IllegalArgumentException("Факториал отрицательного числа не определен");
7+
}
8+
long result = 1;
9+
for (int i = 1; i <= n; i++) {
10+
result *= i;
11+
}
12+
return result;
13+
}
14+
15+
public static void main(String[] args) {
16+
int[] testNumbers = {0, 5, 10, -10};
17+
for (int testNumber : testNumbers) {
18+
System.out.println("Факториал " + testNumber + " = " + factorial(testNumber));
19+
}
20+
}
21+
}
22+

students/23K0087/README.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Абсулов Даниил
2+
КВБО-01-23

students/23K0087/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>algorithms-and-data-structures</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0087</artifactId>
12+
<packaging>pom</packaging>
13+
<description>Практическая работа Даниила</description>
14+
15+
<modules>
16+
<module>23K0087-p01</module>
17+
</modules>
18+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23K0112</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0112-p01</artifactId>
12+
<description>Массивы</description>
13+
</project>

0 commit comments

Comments
 (0)