Lesson 4 complete

This commit is contained in:
DESKTOP-8HAFCLV\Yugr 2025-06-27 12:46:02 +04:00
parent 7f67cd98ca
commit 0f46a0936e
1 changed files with 13 additions and 6 deletions

View File

@ -5,8 +5,17 @@ function DrawLine(count: number, countP: number){
console.log(minimalP.repeat(countP)+minimalString.repeat(count)); console.log(minimalP.repeat(countP)+minimalString.repeat(count));
} }
let chisloN: number = 3; function DrawTriangle(size: number, offset: number){
for(let index = 1; index <= size; index++){
DrawLine(index * 2 - 1, size - index + offset);
}
}
let chisloN: number = 6;
for(let i = 1; i <= chisloN; i++){
DrawTriangle(i, chisloN - i);
}
//i++ => i = i + 1 //i++ => i = i + 1
//i-- => i = i - 1 //i-- => i = i - 1
@ -16,6 +25,4 @@ let chisloN: number = 3;
// str = str + '*' // i = 0 => str = '*' // i == 1 => '**' // i = 2 => '***' // str = str + '*' // i = 0 => str = '*' // i == 1 => '**' // i = 2 => '***'
// } // }
for(let index = 1; index <= chisloN * 2; index = index + 2){
DrawLine(index, chisloN * 2 -index);
}