Powers of 11 Number Pattern in C

What You’ll Learn
How to print a simple pattern where each row is the next power of 11. We start from 1 and multiply by 11 each time.
⭐ Pattern Output
For 5 rows, the pattern looks like this:
1
11
121
1331
14641Complete C Program
This program prints 5 powers of 11 by multiplying the previous result by 11.
#include <stdio.h>
int main() {
int i;
int res = 1;
for (i = 1; i <= 5; i++) {
if (i == 1)
res = 1;
else
res = res * 11;
printf("%d\n", res);
}
return 0;
}🧠 How It Works
Start with 1
res = 1 represents 11^0.
Loop for rows
for (i = 1; i <= rows; i++) prints one result per row.
Multiply by 11
From the 2nd row onward, we do res = res * 11.
Powers of 11
This generates 11^0 to 11^4 for 5 rows.
Variation — User Input Version
Read the number of rows using scanf().
#include <stdio.h>
int main() {
int i;
int res = 1;
int rows;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (i = 1; i <= rows; i++) {
if (i == 1)
res = 1;
else
res = res * 11;
printf("%d\n", res);
}
return 0;
}💡 Tips for Enhancement
Try These
- Switch to
long longto print more rows safely (still limited) - Compute powers using
pow()(careful with floating-point) - Print Pascal’s triangle directly for a true coefficient pattern
Avoid
- Assuming the Pascal-triangle digit trick works for large rows (carry breaks it)
- Ignoring integer overflow for bigger powers
Key Takeaways
Each row is the previous value multiplied by 11.
This prints powers 11^0 to 11^(rows-1).
The Pascal’s triangle digit resemblance only holds for small rows.
Time complexity is O(rows).
❓ Frequently Asked Questions
10 or 15 introduce digit carry when written as a single number, so the visual trick stops matching.int, overflow comes quickly. Use long long for more range, but it’s still finite.Explore More C Number Patterns!
Practice math + loops with more number sequences.
11^4 = 14641. In Pascal’s triangle, row 4 is 1 4 6 4 1 — which matches the digits before carry starts affecting larger rows.
12 people found this page helpful
