Pyramid Star Pattern
Here you will learn to print a Pyramid Star Pattern in C programming.
Program Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> int main() { int num,i,j; printf("Enter a Number to print Pyramid using Star Pattern : "); scanf("%d",&num); for (int i = 0; i < num; i++) { // Print left side spaces for (int j = num; j > i; j--) { printf(" "); } // Print stars for (int k = 0; k < i + 1; k++) { printf("* "); } printf("\n"); } return 0; } |
Output