New: 77 pattern programs with tested code in C, C++, Java and Python Explore patterns

Learn Programming Logic with Pattern Programs

  • Students
  • Beginners
  • Interview prep
  • 77 pattern programs, from star triangles to spirals
  • Tested code in C, C++, Java and Python for every pattern
  • Real output and a row-by-row diagram that explains the logic
Code in: C C++ Java Python

Most Popular Collection

Star Patterns

  • 22 pattern programs
  • Code in C, C++, Java and Python
  • Real output and a row-by-row diagram for every pattern
  • From simple triangles to hollow shapes and diamonds
View all patterns

All Pattern Collections

Pick a collection and practise one pattern at a time, from simple triangles to spirals.

Why Learn with Pattern Programs

Tested code in 4 languages

Every program is compiled and run in C, C++, Java and Python before it is published.

Real output, not screenshots

See the exact text each program prints, so you can check your own result line by line.

Row-by-row diagrams

A picture of every row shows how many spaces and characters it needs, and why.

Logic explained step by step

Each pattern breaks the loops down into simple formulas you can reuse for new shapes.

Free, no sign-up

All patterns and tutorials are free to read, copy and practise. No account needed.

Exam and interview practice

Pattern programs are a favourite in coding tests; practise the classics and their variations.

77Pattern programs
4Languages: C, C++, Java, Python
10Pattern collections
300+Tested code samples

Latest from the Blog

View all articles

Stuck on a pattern?

Tell us the pattern you want to print and we will publish it with tested code in C, C++, Java and Python.

Write to us