#include <iostream>
using namespace std;
int main() {
cout << "Enter a Number(Row) : ";
int n;
cin >> n;
cout << endl;
int row = 1;
while(row <= n){
int col = row;
// can use third variable(counting) to do this question
// this is more optimized in terms of space.
while( col < row * 2){
cout << col << " ";
col += 1;
}
cout << endl;
row += 1;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: