The powers of 11 pattern prints one number per line, starting at 1 and multiplying by 11 each row.
Remember
Rule: res starts at 1; each next row is res * 11
1
11
121
1331
14641 ← n = 5
Unlike Program 47 (2D concentric diamond), this is a 1D sequence — one loop, one running variable, no nested loops.
Approach
How to Solve It
One loop, one running variable — log the current value, then multiply by 11.
Method
Idea
Best for
Running product
console.log(res); res *= 11;
Classic demos
Exponentiation
console.log(11 ** power) for power = 0..n-1
Direct formula
Pseudocode
Pseudocode
res = 1
repeat n times:
print res
res = res * 11
Cheat sheet
Goal
Pattern
Start value
let res = 1;
Loop rows
for (let i = 0; i < n; i++)
Print term
console.log(res);
Next term
res *= 11;
By power
console.log(11 ** power);
Printing Numbers vs Starting a New Line
API
Effect
Use for
line += …
Stays on the same row
Not needed here — one number per row
console.log(res)
Prints the value and ends the row
Each power-of-11 term
Same idea as C# WriteLine(res): each term is a complete line by itself.
Try it
Live Preview
Change the row count and the powers-of-11 sequence updates instantly.
Whole numbers from 1 to 10. Beyond that, prefer BigInt for exact values. Tap a chip or type a value — the preview redraws as you go.
Live resultn = 5 · last = 14641
1
11
121
1331
14641
Trace
Worked Walkthrough
Trace the first four rows — watch res before and after *= 11.
Row
Print res
Then res *= 11
1
1
11
2
11
121
3
121
1331
4
1331
14641
Order matters: log first, then multiply — otherwise the first line becomes 11.
Code
JavaScript Programs
Three complete programs: fixed n = 5, prompt input, and an exponentiation approach. Use View Output for samples, or Try It Yourself to edit and run live.
Example 1 — Fixed n = 5
Print the current term, then multiply by 11 for the next row.
JavaScript
const n = 5;
let res = 1;
for (let i = 0; i < n; i++) {
console.log(res);
res *= 11;
}
2. Log, then multiply.console.log(res) prints the current term; res *= 11 prepares the next.
3. Repeat n times. Five iterations produce 1, 11, 121, 1331, 14641.
Example 2 — User Input Rows
Read n with prompt and validate before printing.
JavaScript
const n = parseInt(prompt("Enter number of rows:"), 10);
let res = 1;
if (!Number.isFinite(n) || n < 1) {
console.log("Please enter a positive integer.");
} else {
for (let i = 0; i < n; i++) {
console.log(res);
res *= 11;
}
}