Rectangle Star Polyhedral Dice and Pyramid pattern Program in C

Polyhedral Dice and Pyramid pattern Program in C

Hello Student in this example,  today you will learn how to print Polyhederal pyramids in C, Using For( ) loop
before understanding this program you need to learn Number Pattern Program (click)

Thank you for reading this post, don't forget to subscribe!

Star Pattern in C

#include<stdio.h>
void print (int);

int main () {
int rows;

printf("Enter Size of Polyhedral pattern:-");

scanf("%d", &rows);

print(rows);

return 0;
}

void print (int r) {
int c, space;
static int stars = -1;

if (r <= 0)
return;

space = r - 1;
stars += 2;

for (c = 0; c < space; c++)
printf(" ");

for (c = 0; c < stars; c++)
printf("*");

printf("\n");

print(--r);

space = r + 1;
stars -= 2;

for (c = 0; c < space; c++)
printf(" ");

for (c = 0; c < stars; c++)
printf("*");

printf("\n");
}

 

Hollow parallelogram Star pattern (clikhere)

Rectangle Pattern Programm in C (clikhere)

Pyramid pattern program in c

Output
Enter Size of Polyhedral pattern:- 4

      *
    ***
  *****
*******
  *****
   ***
     *

Rectangle Pattern program in C

Polyhedral Dice and Pyramid pattern Program in C
Polyhedral Dice and Pyramid pattern Program in C

Saurabh Nissa

This is SaurabhNissa, Owner of Thesmolt.com I'm Graduated from Magadh University in 2019 with 75%. Currently, I'm working on my Personal educational website for teaching Programming language free of Coast, and want to provide a Full setup for Specially BCA student