#include<iostream>
using namespace std;
int main(){
    int a[4][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
    int i=0,j,n=3,l=0,m=n;
    j=n;

    while(i<=n){
        int i1=i,j1=j,k=0,l=n;
        for(;k<j1;i1++,j1--){
            swap(a[k][i1],a[j1][l]);
            if(i!=0){
                swap(a[i1][k],a[l][j1]);
            }
            k++;
            l--;
        }
        i++;
        j--;
    }

    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }

    return 0;
}

On Mon, Jun 7, 2010 at 8:26 AM, sharad <sharad20073...@gmail.com> wrote:

> write a c routine to flip an nXn matrix about its non major diagnol
>
>
> 3       4       5
> 6       7       9
> 1       2       8
>
> Transpose is:
> 8       9       5
> 2       7       4
> 1       6       3
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to