Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

the pyramid in c++

#include <iostream>
using namespace std;

int main()
{
    int rows;

    cout << "Enter number of rows: ";
    cin >> rows;
	
  	int i = 1;
    while(i  <= rows)
    {
      	int j = 1
        while(j <= i)
        {
            cout << "* ";
          	j++
        }
        cout << "
";
      	i++;
    }
    return 0;
}
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #pyramid
ADD COMMENT
Topic
Name
6+6 =