Header Ads Widget

hollow pyramid printing in c

 in this post we will write a code for printing the hollow pyramid . the structure of hollow pyramid is :-

  *
* *
* *
* *
* *
* *
* * * * * * * *
here we will write a code for the hollow pyramid printing in c .

Code:-

#include<stdio.h>
int main()
{
int i,j,k,row;
printf("Enter the number of rows ");
scanf("%d",&row);
for(i=1;i<=row;i++)
{
for(j=i;j<row;j++)
{
printf(" ");
}
for(k=1;k<=(2*i-1);k++)
{
if(k==1||k==(2*i-1)||i==row)
{
printf("*");
}
else
printf(" ");
}
printf("\n");
}
return 0;
}

output:-

Enter the number of rows 7
*
* *
* *
* *
* *
* *
* * * * * * * *



keywords:-

,hollow pyramid pattern in c, inverted hollow pyramid star pattern in c, hollow pyramid star pattern in c, hollow pyramid star pattern in python, hollow pyramid star pattern in java, hollow pyramid pattern in java, hollow triangle pattern in c while loop, hollow pyramid star pattern in javascript,


Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-



Post a Comment

0 Comments