• + 0 comments

    C++

    void staircase(int n) {
    string hash = "#";
    for (int i = 0; i < n; i++, hash += "#") {
        for (int j = n-i; j > 1; j--) {
            cout << " ";
        }
        cout << hash << endl;
        }
    }