Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- short unsigned int n;
- cin >> n;
- int array[n][n];
- //fill
- for (int x = 0; x < n; x++) {
- for (int y = 0; y < n; y++) {
- array[x][y] = abs(y-x);
- }
- }
- //output
- for (int x = 0; x < n; x++) {
- for (int y = 0; y < n; y++) {
- cout<<array[x][y]<<" ";
- }
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement