C# Alphabet Pattern Programs

Beginner
6 min read
Updated: Nov 2026
3 examples
char + Console.Write

Definition and Usage

A C# alphabet pattern is a console program that prints letters in rows. The outer for loop chooses the row. The inner for loop prints each char with Console.Write, then Console.WriteLine ends that row.

Letters come from C# character arithmetic. 'A' is a numeric char, so letter++ walks A, B, C… and (char)('A' + offset) jumps straight to a letter. Keep the offset inside 0–25 when the shape should stay in A–Z.

One row, two calls.

Console.Write(letter) stays on the line. Console.WriteLine() runs once after the inner loop and starts the next row.

C# Syntax

The same three pieces show up in every program below: a row loop, a letter, and Console.Write.

C#
for (int row = 1; row <= rows; row++)
{
    char letter = 'A';
    for (int col = 1; col <= row; col++)
    {
        Console.Write(letter);   // same line
        letter++;                 // next char
    }
    Console.WriteLine();         // end the row
}

How C# Prints a Letter

Map each part of the console shape to a C# type or call.

PieceC#What it does
Letterchar letter = 'A';UTF-16 code unit you can increment
Next letterletter++A becomes B on the same row
Jump(char)('A' + col)Cast the int sum back to char
Same lineConsole.Write(letter)No newline between letters
New rowConsole.WriteLine()Finish the row
IndentConsole.Write(' ')Leading spaces for pyramids
A–Z sliceletters.Substring(0, n)Same growing row without an inner char loop

C# Examples

Three console programs. Each one changes only the C# that picks the letter or the space.

Example 1 — Grow a row with char++

Restart at 'A' on every row, then increment inside the inner loop.

C#
using System;

class CharTriangle
{
    static void Main()
    {
        int rows = 5;

        for (int row = 1; row <= rows; row++)
        {
            char letter = 'A';
            for (int col = 1; col <= row; col++)
            {
                Console.Write(letter);
                letter++;
            }
            Console.WriteLine();
        }
    }
}

How It Works

  1. The outer for sets how many letters this row prints.
  2. char letter = 'A' starts every row at A.
  3. letter++ advances the char; WriteLine ends the row.

Example 2 — Pick the letter with a cast

Skip the running char. Compute it from the column index.

C#
using System;

class CharCast
{
    static void Main()
    {
        int rows = 4;

        for (int row = 0; row < rows; row++)
        {
            for (int col = 0; col <= row; col++)
            {
                char letter = (char)('A' + col);
                Console.Write(letter);
            }
            Console.WriteLine();
        }
    }
}

How It Works

  1. 'A' + col is an int, not a char.
  2. The (char) cast turns that sum back into a letter.
  3. Column 0 is A, column 1 is B, and so on.

Example 3 — Indent with Console.Write(' ')

Print spaces before the letters so the triangle sits on the right.

C#
using System;

class CharSpaces
{
    static void Main()
    {
        int rows = 4;

        for (int row = 1; row <= rows; row++)
        {
            for (int space = 1; space <= rows - row; space++)
                Console.Write(' ');

            for (int col = 1; col <= row; col++)
                Console.Write((char)('A' + col - 1));

            Console.WriteLine();
        }
    }
}

How It Works

  1. The first inner loop prints rows - row space characters.
  2. The second loop prints letters with the same (char) cast.
  3. Fewer spaces and more letters on each later row pull the shape right.

34 C# Alphabet Pattern Programs

Each card is a full console program: nested for loops, char math, and the letters Console.Write prints. Open one for the walkthrough.

Alphabet Pattern 1
Alphabet Pattern 2
Alphabet Pattern 3
Alphabet Pattern 4
Alphabet Pattern 5
Alphabet Pattern 6
Alphabet Pattern 7
Alphabet Pattern 8
Alphabet Pattern 9
Alphabet Pattern 10
Alphabet Pattern 11
Alphabet Pattern 12
Alphabet Pattern 13
Alphabet Pattern 14
Alphabet Pattern 15
Alphabet Pattern 16
Alphabet Pattern 17
Alphabet Pattern 18
Alphabet Pattern 19
Alphabet Pattern 20
Alphabet Pattern 21
Alphabet Pattern 22
Alphabet Pattern 23
Alphabet Pattern 24
Alphabet Pattern 25
Alphabet Pattern 26
Alphabet Pattern 27
Alphabet Pattern 28
Alphabet Pattern 29
Alphabet Pattern 30
Alphabet Pattern 31
Alphabet Pattern 32
Alphabet Pattern 33
Alphabet Pattern 34

Frequently Asked Questions

A char is a numeric UTF-16 code unit. letter++ advances one letter, and (char)('A' + offset) jumps to a specific letter. Cast when you add an int so the result stays a char.
Console.Write prints and stays on the same line, which is how each letter in a row is placed. Console.WriteLine ends the row. Call WriteLine once after the inner loop.
Char math continues past Z into other characters. For A–Z demos, keep rows between 1 and 26. int.TryParse is the safe way to read a row count from the console.
Yes. Store "ABCDEFGHIJKLMNOPQRSTUVWXYZ" and call Substring(0, length) for a row that always starts at A. Nested char loops are the skill these programs teach; Substring is a shortcut once the shape is clear.

Next: Alphabet Pattern 1

A full C# walkthrough of the right-angled letter triangle, from 'A' through Console.WriteLine.

Alphabet Pattern 1 →

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.

28 people found this page helpful