Skip to content

Commit f1dbb21

Browse files
committed
new
1 parent 2260539 commit f1dbb21

File tree

9 files changed

+116
-9
lines changed

9 files changed

+116
-9
lines changed

Danil/homework_3_js /script.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Сумма чисел
22

3-
/*let sum = null;
3+
let sum = null;
44

55
for (i = 1; i <= 100; i++) {
66
sum += i;
77
}
8-
console.log(sum);*/
8+
console.log(sum);
99

1010
//Факториал
1111

12-
/*let counter = prompt("Введите число!", "");
12+
let counter = prompt("Введите число!", "");
1313
counter = parseInt(counter);
1414

1515
function factorial(x) {
@@ -19,11 +19,11 @@ function factorial(x) {
1919
return x * factorial(x - 1);
2020
}
2121

22-
alert("Факториал числа: " + counter + "! = " + factorial(counter));*/
22+
alert("Факториал числа: " + counter + "! = " + factorial(counter));
2323

2424
// Степень
2525

26-
/* function degree(number, n) {
26+
function degree(number, n) {
2727
let result = number;
2828

2929
for (var i = 1; i < n; i++) {
@@ -43,12 +43,12 @@ if (n <= 1) {
4343
} else if (!Number(number) || !Number(n)) {
4444
alert("Вы ввели не число!", "");
4545
} else {
46-
alert(number + " в степени " + n + " = " + degree(number, n));
47-
}*/
46+
alert(number + " в степени " + n + " = " + degree(number, n));
47+
}
4848

4949
// Таблица умножения
5050

51-
/*function math() {
51+
function math() {
5252
while (1) {
5353
let x = Math.floor(Math.random(1) * 10);
5454
let y = Math.floor(Math.random(1) * 10);
@@ -63,4 +63,4 @@ if (n <= 1) {
6363
}
6464
}
6565

66-
math();*/
66+
math();

Danil/homework_4_js /task1.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="task1.js"></script>
11+
</body>
12+
</html>

Danil/homework_4_js /task1.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let a = +prompt("Введите первое число!", "");
2+
let b = +prompt("Введите второе число!", "");
3+
4+
function getEvenNumbers(a, b) {
5+
for (let i = a; i <= b; i++) {
6+
if (i % 2 == 0) {
7+
console.log(i);
8+
}
9+
}
10+
}
11+
12+
getEvenNumbers(a, b);

Danil/homework_4_js /task2.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="task2.js"></script>
11+
</body>
12+
</html>

Danil/homework_4_js /task2.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
let num = prompt("Введите число", "");
2+
let num2 = prompt("Введите второе число", "");
3+
4+
function averageSum(num, num2) {
5+
let arr1 = num.split("");
6+
let arr2 = num2.split("");
7+
let arr = arr1.concat(arr2);
8+
let sum = eval(arr.join("+"));
9+
let result = sum / arr.length;
10+
console.log(arr1);
11+
console.log(arr2);
12+
console.log(arr);
13+
console.log(sum);
14+
console.log(result);
15+
alert("Среднее арифметическое сумм цифр в этих числах = " + result);
16+
}
17+
18+
averageSum(num, num2);

Danil/homework_4_js /task3.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="task3.js"></script>
11+
</body>
12+
</html>

Danil/homework_4_js /task3.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
let message = prompt("Введите слово!", "");
2+
3+
function showFiveMessages(message) {
4+
setTimeout(function() {
5+
console.log(message);
6+
}, 1000);
7+
}
8+
9+
for (var i = 5; i <= 0; i--) {
10+
showFiveMessages(message);
11+
}

Danil/homework_4_js /task4.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="task2.js"></script>
11+
</body>
12+
</html>

Danil/homework_4_js /task4.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
let num = prompt("Введите число", "");
2+
let num2 = prompt("Введите второе число", "");
3+
4+
function averageSum(num, num2) {
5+
let arr1 = num.split("");
6+
let arr2 = num2.split("");
7+
let arr = arr1.concat(arr2);
8+
let sum = eval(arr.join("+"));
9+
let result = sum / arr.length;
10+
console.log(arr1);
11+
console.log(arr2);
12+
console.log(arr);
13+
console.log(sum);
14+
console.log(result);
15+
alert("Среднее арифметическое сумм цифр в этих числах = " + result);
16+
}
17+
18+
averageSum(num, num2);

0 commit comments

Comments
 (0)