Skip to content

Instantly share code, notes, and snippets.

@calindotgabriel
Last active August 29, 2015 14:01
Show Gist options
  • Save calindotgabriel/1832e76a6e59f4e07459 to your computer and use it in GitHub Desktop.
Save calindotgabriel/1832e76a6e59f4e07459 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int a[10][10], n;
void show () {
cout << "--------------- \n";
for (int i = 0 ; i < n ; i ++) {
for (int j = 0 ; j < n ; j ++ )
cout << a[i][j] << " ";
cout << "\n";
}
}
void computeB () {
int k = n;
for (int i = 0 ; i < n ; i ++) {
a[0][i] = k++;
}
for (int i = 0 ; i < n ; i ++) {
for (int j = 1 ; j < n ; j ++)
a[j][i] = a[j-1][i] - 1 ;
}
show();
}
int main()
{
cin >> n;
computeB();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment