C Number Pattern Programs

Understanding number patterns
Number pattern programs print digits in rows and columns to form triangles, pyramids, diamonds, and other figures. They are one of the best ways to practice nested for loops and printf formatting in C.
From simple ascending and descending triangles to sequences mixed with stars or spaces, each exercise sharpens how you think about row indices, column bounds, and the value you print at each cell.
Why explore number patterns?
Digits make it easy to see when row logic drifts: one wrong inner bound and the sequence breaks in a way you can spot immediately.
Math and loops together
Many patterns echo arithmetic progressions, running sums, or tables. Writing them in C connects formulas on paper to what actually prints in the console.
Structured problem solving
You decide what each row starts with, how many values it prints, and how spaces align the block. That is the same decomposition skill you use in larger programs.
Interview-friendly drills
Entry-level C screenings often include a small triangle or pyramid. Working through these patterns prepares you to code under time pressure without freezing.
How to use this collection
Treat the list below as a menu: skim previews, open a tutorial when a shape matches what you need, then adapt the row counts and rules for your own exercises.
Start with familiar shapes
If you are new, begin with Number Pattern 1 and move forward. Each page shows output, complete C code, and a clear walkthrough.
Change one rule at a time
After a program works, adjust row count, starting value, or spacing. Re-run and compare output so you see exactly which loop controls which part of the figure.
Pair with stars and letters
The same loop skeletons appear in star patterns and alphabet patterns. Once digits feel natural, swapping the printed symbol is straightforward.
Complete list of C number pattern programs
Below are 62 number pattern programs in C. Each card shows sample output; open it for the full program, logic breakdown, variations, and FAQs.
Combining printf("%d", n) with width specifiers like %2d or %3d is often the difference between a crooked triangle and columns that line up when values become two or three digits wide.
Ready to code?
Open Number Pattern 1 for a full walkthrough, runnable C source, and common interview questions.
28 people found this page helpful
