print half pyramid

Solutions on MaxInterview for print half pyramid by the best coders in the world

showing results for - "print half pyramid"
Adnan
21 Feb 2017
1#include <bits/stdc++.h>
2using namespace std;
3
4int main()
5{
6    int rows;
7
8    cout << "Enter number of rows: ";
9    cin >> rows;
10
11    for(int i = 1; i <= rows; ++i)
12    {
13        for(int j = 1; j <= i; ++j)
14        {
15            cout << "* ";
16        }
17        cout << "\n";
18    }
19    return 0;
20}