#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int arr[n][n];
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= i; j++){
            if (i == j || j == 1){
                arr[i][j] = 1;
            } else {
                arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j];
            }
            cout << arr[j];
        }
        cout << "\n";
    }
}

Embed on website

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