In this program, you'll learn to print diamond star pyramid.
#include<iostream>
using namespace std;
int main()
{
int i, j, s, k;
for(i=0; i<3; i++)
{
for(s=0; s<2 -i; s++)
{
cout<< " ";
}
for(j=0;j<=i; j++)
{
cout<< "* ";
}
cout<< "\n";
}
for(i=0; i<2; i++)
{
for(s=0; s<=i; s++)
{
cout<< " ";
}
for(j=2;j>i; j--)
{
cout<< "* ";
}
cout<< "\n";
}
return 0;
}
*
* *
* * *
* *
*