Pyramid pattern

<br /> 

#include<iostream>
using namespace std;
int main()
{
int i,j,k,l,a;
cout<<"Enter the number of lines in the pyramid=";
cin>>a;
cout<<endl;
for(i=1;i<=a;i++)
{
for(j=a;j>=i;j--)
cout<<" ";
for(k=1;k<=i;k++)
{
cout<<"*";
}
for(l=1;l<=i-1;l++)
cout<<"*";

cout<<endl;

}
return 0;
}

 

output:

capture

Leave a comment