Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 3: Write a C++ program to print the pyramid of *.

#include<iostream.h>
#include<conio.h>
int main()
{
	clrscr();
	int i,space,row,k=0;
	cout<<"\nenter the number of rows:";
	cin>>row;

	for(i=1;i<=row;i++)
	{
		cout<<"\n";
		for(space=1;space<=row-i;space++)
		cout<<"\t ";

		while(k!=(2*i-1))
		{
			cout<<"\t*";
			++k;
		}

		k=0;
		cout<<"\n";
	}

	getch();
	return 0;
}



If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.