Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created September 16, 2017 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invatainfo/e891a356394d28c04f806bcfd6873ef5 to your computer and use it in GitHub Desktop.
Save invatainfo/e891a356394d28c04f806bcfd6873ef5 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
int i, n, j, a[30][30];
cin >> n;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (i == j)
a[i][j] = 0;
else
a[i][j] = n - j;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++)
cout << a[i][j] << " ";
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment