Skip to content

Commit

Permalink
rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
FazeelUsmani authored Nov 9, 2019
1 parent eae7cd4 commit 2772988
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions 004 Rotation of matrix.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void rot(int ar[][100], int r, int c)
{

for(int k=0;k<r;k++)
{
for(int i=r-1; i>=0; i--)
{
cout<<ar[i][k]<<" ";
}

cout<<"\n";
}
}


int main() {
int t,n, x=0;
cin>>t;
while(t--)
{
cin>>n;
x++;
int ar[100][100];
for(int i=0;i<n;i++)
for(int j=0; j<n;j++)
cin>>ar[i][j];
cout<<"Test Case #"<<x<<":"<<"\n";
rot(ar,n,n);
}


return 0;
}

0 comments on commit 2772988

Please sign in to comment.