Write a program to display the output below:
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
#include <iostream>
using namespace std;
int main()
{
for(int i=0;i<=10;i++)
{
if(i<=5)
{
for(int j=0;j<=2*i;j++)
{
cout<<"*";
}
}
else
{
for(int j=0;j<=20-2*i;j++)
{
cout<<"*";
}
}
cout<<endl;
}
}
Comments
Leave a comment