#include <iostream>
using namespace std;

int main() {
    cout << "Enter Row Input : " ;
    int n;
    cin >> n;
    cout << endl;
    
    int row = 1;

    while(row <= n){
        
        // printing spaces
        int space = row - 1;
        while(space){
            cout << "- " ;
            space -= 1;
        }
        
        // printing stars
        int stars = n - row + 1;
        while(stars){
            cout << row << " " ;
            stars -= 1;
        }
        cout << endl;
        row += 1;
    }
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: