Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[23][23],n,i,j,k=1;
- cin>>n;
- for (i=0;i<n;i++) {
- for (j=i;j<n;j++){
- a[i][j]=k;
- a[j][i]=k;
- }
- k++;
- }
- for (i=0;i<n;i++)
- {
- for(j=0;j<n;j++)
- cout<<a[i][j]<<' ';
- cout<<endl;
- }
- /*
- int a[100][100],n,i,j,x=1,nr=0;
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++) {
- x=1;
- for (j=0;j<n;j++) {
- if (j>=n-nr)
- {
- a[i][j]=x;
- x++;
- }
- else
- a[i][j]=1;}
- nr++;
- }
- for (i=0;i<n;i++) {
- for (j=0;j<n;j++)
- cout<<a[i][j]<<' ';
- cout<<endl;
- }*/
- return 0;//
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement