//output the Henkel matrix for given input n // Ex if n = 5: // 1 2 3 4 5 // 2 3 4 5 6 // 3 4 5 6 7 // 4 5 6 7 8 // 5 6 7 8 9 #include using namespace std; int main() { //declare variables int n; //ask user for number n cout << "Enter number less than 50 " << endl; cin >> n; //output matrix for n //loop for each row for(int i = 1; i<= n; i++) { //output the columns in the row //loop to output each cell int j; for(j = 1; j <= n; j++) { //output the number i+j -1 cout << i + j -1; if (i+j-1 < 10) { cout << " "; } else { cout << ' '; } } //end line cout << endl; } return 0; }