Answer to Question #284717 in C++ for papi

Question #284717

Write a program to display the output below:



*

* * *

* * * * *

* * * * * * *

* * * * * * * * *

* * * * * * * * * * *

* * * * * * * * *

* * * * * * *

* * * * *

* * *

*


1
Expert's answer
2022-01-12T05:07:37-0500
#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;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog