Skip to content

Commit

Permalink
Merge pull request #1 from MastersAcademy/master
Browse files Browse the repository at this point in the history
homework_1
  • Loading branch information
NikolasGumenyuk authored Nov 10, 2018
2 parents 545fe08 + 02c275f commit 6a19019
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
7 changes: 7 additions & 0 deletions homeworks/evgen.kushnir_darknel/homework_2/numbers.js
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}`);
}
}
10 changes: 10 additions & 0 deletions homeworks/evgen.kushnir_darknel/homework_2/piramid.js
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 homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-1_js.js
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 homeworks/konstantin.tsarenko_KTsarenko/homework_2/hw2-2_js.js
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();
}
});
});

0 comments on commit 6a19019

Please sign in to comment.