-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MastersAcademy/master
новые дз 3 и4
- Loading branch information
Showing
225 changed files
with
4,494 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Get the number from the console | ||
const readline = require('readline'); | ||
|
||
const r1 = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
// The function of calculating mirror numbers. | ||
function func(num) { | ||
for (let i = 1; i <= num; i++) { | ||
const str = String(i); | ||
if (str.length === 3) { | ||
if (str[0] === str[2]) { | ||
console.log(str); | ||
} | ||
} | ||
if (str.length === 4) { | ||
if (str[0] === str[3] && str[1] === str[2]) { | ||
console.log(str); | ||
} | ||
} | ||
if (str.length === 5) { | ||
if (str[0] === str[4] && str[1] === str[3]) { | ||
console.log(str); | ||
} | ||
} | ||
if (num < 100 || num > 99999 || num === 0) { | ||
console.log('Ошибка ввода'); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
r1.question('Введите количество символов (от 100 до 99999): ', (num) => { | ||
func(num); | ||
r1.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Get the number from the console | ||
const readline = require('readline'); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
// Pyramid function | ||
function func(num) { | ||
let i = 2; | ||
const bs = ' '; | ||
const str = '#'; | ||
let j; | ||
if (num > 50) { | ||
console.log('Число больше 50'); | ||
return; | ||
} | ||
for (j = num; j >= 1; j--) { | ||
i += 2; | ||
console.log(bs.repeat(j) + str.repeat(i)); | ||
} | ||
} | ||
|
||
rl.question('Ввкдите количкство строк (до 50шт.): ', (num) => { | ||
func(num); | ||
rl.close(); | ||
}); |
11 changes: 11 additions & 0 deletions
11
homeworks/Aleksey.Belik_ipodmeloman/homework_1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "package.json", | ||
"version": "1.1.1", | ||
"description": "node version v10.13.0 npm version 6.4.1", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alex@alex-System-Product-Name:~$ node --version | ||
v10.13.0 | ||
alex@alex-System-Product-Name:~$ npm --version | ||
6.4.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function checkPl(str) { | ||
return (str === str.split('').reverse().join('')); | ||
} | ||
|
||
for (let i = 500; i < 1000; i++) { | ||
const x = String(i); | ||
if (checkPl(x) === true) { | ||
console.log(x); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function build(num) { | ||
let li = num; | ||
const symbl = '#'; | ||
const space = '_'; | ||
let i = 2; | ||
|
||
for (li > 0; li--;) { | ||
i += 2; | ||
console.log(space.repeat(li) + symbl.repeat(i)); | ||
} | ||
} | ||
|
||
build(15); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
|
||
|
||
|
||
alex@alex-Aspire:~/MOC/js-course-2018/homeworks/Alexey.Bezpoyasny_AlexBezp/homework_1$ node -v | ||
v11.1.0 | ||
alex@alex-Aspire:~/MOC/js-course-2018/homeworks/Alexey.Bezpoyasny_AlexBezp/homework_1$ npm --version | ||
6.4.1 | ||
|
11 changes: 11 additions & 0 deletions
11
homeworks/Alexey.Bezpoyasny_AlexBezp/homework_1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "hm1", | ||
"version": "1.0.0", | ||
"description": "hm_1", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Alexey Bezpoyasny", | ||
"license": "ISC" | ||
} |
2 changes: 2 additions & 0 deletions
2
homeworks/Andrew.Tsarevsky_TsarevskyAndrew/homework_1/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node v10.13.0 | ||
npm 6.4.1 |
11 changes: 11 additions & 0 deletions
11
homeworks/Andrew.Tsarevsky_TsarevskyAndrew/homework_1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "homework_1", | ||
"version": "1.0.0", | ||
"description": "node v10.13.0\r npm 6.4.1", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Tsarevsky Andrew", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node 11.1.0 | ||
npm 6.4.1 |
12 changes: 12 additions & 0 deletions
12
homeworks/Bohdan.Krasnoschok_kAmIkAdzE9/homework_1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "homework_1", | ||
"version": "1.0.0", | ||
"description": "node 11.1.0\r npm 6.4.1", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const N = 15; | ||
const str = ' '; | ||
const str2 = '##'; | ||
for (let i = 0; i < N; i++) { | ||
console.log(str.repeat(N - i) + str2.repeat(i + 2)); | ||
} |
14 changes: 14 additions & 0 deletions
14
homeworks/Bohdan.Krasnoschok_kAmIkAdzE9/homework_2/Task_2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const a = 500; | ||
const b = 1000; | ||
for (let i = a; i < b; i++) { | ||
i += ''; | ||
let flag = true; | ||
for (let j = 0; j < i.length / 2; j++) { | ||
if (i[j] !== i[i.length - 1 - j]) { | ||
flag = false; | ||
} | ||
} | ||
if (flag === true) { | ||
console.log(i); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
v10.13.0 | ||
6.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "homework_1", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"description": "" | ||
} |
27 changes: 27 additions & 0 deletions
27
homeworks/Dmitriy.Tyulpa_innocentDimon/homework_2/mirror.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
const readline = require('readline'); | ||
|
||
const mirrorRange = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
function isMirror(str) { | ||
return str === str.split('').reverse().join(''); | ||
} | ||
|
||
mirrorRange.question('Введите диапазон чисел через пробел: ', (range) => { | ||
const rangeArray = range.split(' '); | ||
const min = Number(rangeArray[0]); | ||
const max = Number(rangeArray[1]); | ||
if (rangeArray.length > 2 || Number.isNaN(min) || Number.isNaN(max) || min >= max) { | ||
console.log('Введите правильный диапазон'); | ||
} else { | ||
for (let i = min; i < max + 1; i++) { | ||
if (isMirror(i.toString())) { | ||
console.log(i); | ||
} | ||
} | ||
} | ||
mirrorRange.close(); | ||
}); |
22 changes: 22 additions & 0 deletions
22
homeworks/Dmitriy.Tyulpa_innocentDimon/homework_2/pyramid.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
const readline = require('readline'); | ||
|
||
const pyramidHeight = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
pyramidHeight.question('Введите высоту пирамиды? ', (height) => { | ||
if (Number.isNaN(Number(height))) { | ||
console.log('Необходимо ввести число!'); | ||
} else { | ||
const str = '#'; | ||
const space = ' '; | ||
let top = 4; | ||
for (let i = 0; i < height; i++) { | ||
console.log(space.repeat(height - (i + 1)) + str.repeat(top)); | ||
top += 2; | ||
} | ||
} | ||
pyramidHeight.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
for (let i = 5; i <= 9; i++) { | ||
for (let j = 0; j <= 9; j++) { | ||
console.log(i.toString() + j + i); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
for (let i = 1; i <= 15; i++) { | ||
console.log(' '.repeat(15 - i) + '#'.repeat((i + 1) * 2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
V***:~$ node -v | ||
v10.13.0 | ||
V***:~$ npm --version | ||
6.4.1 | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
homeworks/Ivan.Artemenko_IvanArtemenko/homework_1/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "homework_1", | ||
"version": "1.0.0", | ||
"description": "V:~$ node -v v10.13.0 V:~$ npm --version 6.4.1", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
20 changes: 20 additions & 0 deletions
20
homeworks/Ivan.Artemenko_IvanArtemenko/homework_2/homework_2_1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const readline = require('readline'); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
rl.question('Enter the number of triangle levels from 3 to 15 ', (number) => { | ||
const numeric = number - 0; | ||
if (numeric <= 16 && numeric >= 3) { | ||
for (let i = 2; i <= numeric + 1; i++) { | ||
let a = '**'; | ||
let b = ' '; | ||
const j = ((numeric + 1) - i); | ||
a = a.repeat(i); | ||
b = b.repeat(j); | ||
console.log(b + a); | ||
} | ||
} else console.log('You must enter a number from 3 to 15'); | ||
rl.close(); | ||
}); |
32 changes: 32 additions & 0 deletions
32
homeworks/Ivan.Artemenko_IvanArtemenko/homework_2/homework_2_2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const readline = require('readline'); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
rl.question('Enter the first number from 500 to 1000 ', (numericOne) => { | ||
rl.question('Enter the second number from 500 to 1000 ', (numericTwo) => { | ||
const a = numericOne - 0; | ||
const b = numericTwo - 1; | ||
if (a >= b) { | ||
if (b + 1 >= 500 && a - 1 < 1000) { | ||
for (let i = b; i <= a; i++) { | ||
const z = i.toString().split('').reverse().join(''); | ||
const k = i.toString(); | ||
if (z === k) { | ||
console.log(i); | ||
} | ||
} | ||
} else console.log('Invalid data enter a number from 500 to 1000'); | ||
} else if (a >= 500 && b < 1000) { | ||
for (let i = a; i <= b; i++) { | ||
const z = i.toString().split('').reverse().join(''); | ||
const k = i.toString(); | ||
if (z === k) { | ||
console.log(i); | ||
} | ||
} | ||
} else console.log('Invalid data enter a number from 500 to 1000'); | ||
rl.close(); | ||
}); | ||
}); |
Oops, something went wrong.