Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / exercise 8 - dollar pyramid.cpp
blob: e32c5ba8291daad39b9d9ff461b37c58df0f91b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;

void printPyramid(int n) {
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= i; j++) 
            cout << "$" << " "; // print as many dollars as the number of the current row
        cout << endl;
    }
}

int main() {
    int n;
    cin >> n;
    printPyramid(n);
    return 0;
}