C++ Reverse Pyramid
Posted by Samath
Last Updated: January 05, 2017

This is a simple program that prints a reverse pyramid using the C++ programming language. The pyramid is created using the do-while loop.

#include <iostream>
#include <cstdlib>
#define MAX 10

using namespace std;

int main(int argc, char const *argv[])
{
	int x, y = MAX;

	do
	{
		x = 0;
		do
		{
			cout << "*";
			x++;
		} while(x <= y);

		cout << endl;
		y--;
	} while(y >= 0);

	cin.get();
	return 0;
}

 

Related Content
C Program to Reverse a Number
C Program to Reverse a Number
Samath | Jan 02, 2017
C Program to Reverse an Array
C Program to Reverse an Array
Samath | Jan 02, 2017