-
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
homework_1
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
for (let test = 500; test < 1000; test++) { | ||
const numberTest = test.toString().split('').reverse().join(''); | ||
const numberTestCheck = test.toString(); | ||
if (numberTest === numberTestCheck) { | ||
console.log(`${test}`); | ||
} | ||
} |
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 @@ | ||
const symbol = '#'; | ||
let startNumber = 4; | ||
const emptySpace = ' '; | ||
let emptySpaceNumber = 14; | ||
|
||
for (let i = 0; i < 15; i++) { | ||
console.log(emptySpace.repeat(emptySpaceNumber) + symbol.repeat(startNumber)); | ||
startNumber += 2; | ||
emptySpaceNumber -= 1; | ||
} |
25 changes: 25 additions & 0 deletions
25
homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.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,25 @@ | ||
const readline = require('readline'); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
rl.question('Ведите высоту пирамиды: ', (answer) => { | ||
if (!Number.isNaN(Math.round(answer))) { | ||
const height = parseInt(answer, 10) + 2; | ||
const space = ' '; | ||
const symbol = '#'; | ||
let i = 2; | ||
for (i; i < height; i++) { | ||
const spaceRep = space.repeat(height - i); | ||
const symbolRep = symbol.repeat(i); | ||
const strResult = spaceRep + symbolRep + symbolRep + spaceRep; | ||
console.log(strResult); | ||
} | ||
rl.close(); | ||
} else { | ||
console.log('Ошибка ввода.'); | ||
rl.close(); | ||
} | ||
}); |
25 changes: 25 additions & 0 deletions
25
homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.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,25 @@ | ||
const readline = require('readline'); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
rl.question('Ведите минимальное значение: ', (answer) => { | ||
const minNum = parseInt(answer, 10); | ||
rl.question('Ведите максимальное значение: ', (answer2) => { | ||
if (!Number.isNaN(Math.round(answer2)) && !Number.isNaN(Math.round(answer))) { | ||
const maxNum = parseInt(answer2, 10); | ||
for (let i = minNum; i <= maxNum; i++) { | ||
const num = i.toString(); | ||
if (num === num.split('').reverse().join('')) { | ||
console.log(num); | ||
} | ||
} | ||
rl.close(); | ||
} else { | ||
console.log('Ошибка ввода.'); | ||
rl.close(); | ||
} | ||
}); | ||
}); |