New course! Every coder should learn Generative AI!
Try a free lesson0
#include<iostream.h>
#include<conio.h>
void main()
{
int p_height=5;
int p_space=p_height-1;
int i,j,k;
int n;
int x=1;
for(i=0;i<p_height;i++){
for(j=p_space;j>i;j--)
{
cout<<" ";
}
for(k=0;k<=i;k++)
{
cout<<"*";
}
for(n=(p_height+p_height-2);n>=x;n--)
{
cout<<" ";
}
for(k=0;k<=i;k++)
{
cout<<"*";
}
x+=2;
cout<<endl;
}
getch();
}