Skip to content

A C-based console application that generates symmetrical geometric patterns (pyramids) using nested loop structures and mathematical progressions ($2n-1$).

License

Notifications You must be signed in to change notification settings

ShotsMan2/ASCII-Pyramid-Pattern-Generatorr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ASCII Pyramid Pattern Generator

This project is an algorithmic implementation in C designed to render geometric patterns (specifically right-angled pyramids) on the console output. It demonstrates the mastery of Nested Control Structures and coordinate logic.

📐 Mathematical Logic

The algorithm constructs the pattern based on an arithmetic progression of odd numbers. For each row $i$:

  • The number of stars ($*$) follows the formula: $Count = 2i - 1$

Iteration Analysis:

  • Row 1 ($i=1$): $j < 2(1) \rightarrow 1$ Star *
  • Row 2 ($i=2$): $j < 2(2) \rightarrow 3$ Stars ***
  • Row 3 ($i=3$): $j < 2(3) \rightarrow 5$ Stars *****
  • Row 4 ($i=4$): $j < 2(4) \rightarrow 7$ Stars *******
  • Row 5 ($i=5$): $j < 2(5) \rightarrow 9$ Stars *********

⚙️ Code Structure

  • Outer Loop: Controls the vertical axis (rows).
  • Inner Loop: Controls the horizontal axis (columns/stars), dependent on the current state of the outer loop.

🚀 Usage

  1. Compile the source code:
    gcc main.c -o pattern_gen
  2. Run the executable:
    ./pattern_gen

This repository demonstrates visual data construction using loops in C.

About

A C-based console application that generates symmetrical geometric patterns (pyramids) using nested loop structures and mathematical progressions ($2n-1$).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages