Print 1, 11, 121, 1331… Pattern in C#

Beginner
⏱️ 5 min read
📚 Updated: Aug 2025
🎯 2 Code Examples
Loops + Number Sequence

What You’ll Learn

How to print the sequence-like number pattern 1, 11, 121, 1331, 14641 in C#.

You’ll use a simple loop and update a running value on each iteration (multiplying by 11 for the first few rows).

⭐ Pattern Output

For n = 5, the pattern looks like this:

Output
1
11
121
1331
14641
1

Complete C# Program

Start with res = 1 and multiply by 11 each row to generate the next value.

C#
using System;

namespace MyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, res = 1;

            for (i = 1; i <= 5; i++)
            {
                if (i == 1)
                    res = i;
                else
                    res = res * 11;

                Console.Write(res);
                Console.WriteLine();
            }
        }
    }
}

🧠 How It Works

1

Initialize the result

int res = 1; holds the current value that will be printed on each row.

Setup
2

Loop through rows

for (i = 1; i <= 5; i++) runs once per printed line.

Loop
3

Update the value

For the first row, set res = i (prints 1). For later rows, update with res = res * 11.

State update
4

Print and move to next line

Console.Write(res) prints the current number and Console.WriteLine() moves to the next row.

Output
=

Growing number pattern

You print exactly one value per row, so the time complexity is O(n) for n rows.

2

Variation — User Input Rows

Let the user decide how many lines to print. (For larger values, prefer BigInteger.)

C#
using System;

namespace MyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            Console.Write("Enter number of rows: ");

            if (!int.TryParse(Console.ReadLine(), out n) || n <= 0)
            {
                Console.WriteLine("Please enter a positive integer.");
                return;
            }

            int res = 1;
            for (int i = 1; i <= n; i++)
            {
                if (i == 1)
                    res = 1;
                else
                    res = res * 11;

                Console.WriteLine(res);
            }
        }
    }
}

💡 Tips for Enhancement

Try These

  • Print each row with padding (e.g., Console.WriteLine(res.ToString().PadLeft(...))) for a cleaner look
  • Use System.Numerics.BigInteger if you want many rows without overflow
  • Swap the multiplier (e.g., 9, 12) to explore different growth patterns
  • Generate the same values using binomial coefficients (for small rows)

Avoid

  • Printing many rows with int (you will overflow quickly)
  • Skipping input validation when reading n from the user
  • Assuming the digits always match Pascal’s triangle (carries break the pattern)

Key Takeaways

1

You can generate the next row by multiplying the previous value by 11 (for the first few rows).

2

This program prints one value per row, so it runs in O(n) time.

3

Numbers grow quickly—use BigInteger when printing many rows.

4

For small rows, these values relate to binomial coefficients; carries make later rows differ.

❓ Frequently Asked Questions

After printing the first 1, the program updates the value with res = res * 11 and prints it on the next line.
Yes. Increase the loop limit or read n from input. For many rows, use BigInteger to avoid overflow.
Only for early rows. When base-10 carry-overs happen, the digits in powers of 11 stop matching the binomial coefficients.
O(n), because the program computes and prints one value per row.

Explore More C# Number Patterns!

Mix sequences, symmetry, and loops to level up your pattern-printing skills.

All Number Patterns →
Did you know?

Powers of 11 display binomial coefficients in their digits only for the first few rows. Once digit carries occur, the visual match breaks—but the loop-based approach still works for generating this specific pattern for small n.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful