C Program to Print Alphabet C Star Pattern with Example
C Program
C program to Print Alphabet C star pattern
Example
C Program to Print Alphabet C Star Pattern with Example
Explain Program
Step :1
#include <stdio.h>
standard input-output library in C, so you
can use printf().
int main() {
int a, b;
int rows = 7;
a and b are loop counters use for iterating through row and columns, respectively.
This loop controls the vertical position (top to bottom).
Inner Loop:
Controls Columns
Controls the horizontal position in each row (left to
right).
Main Logic for Pattern Drawing
if (a == 0 || a == rows - 1 || b == 0)
condition determines when to print a *:
a == rows - 1 → Bottom row (last row)
Step :6
Inner Condition: continue
if ((a == 0 || a == rows - 1) && b > 4)
top or bottom row, column > 4, then:
Space
printf("*");
Print a star if the condition.
else {
printf("
");
}
condition are not met, print to the space.
printing one row,next line.
Output

Post a Comment