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