From 8b485a695270c013578b7964c3cb04aa316cbc85 Mon Sep 17 00:00:00 2001 From: Ekta Sharma <65890887+ekta123s@users.noreply.github.com> Date: Thu, 1 Oct 2020 01:29:32 -0700 Subject: [PATCH] Create Rotate Matrix by 90 --- Rotate Matrix by 90 | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Rotate Matrix by 90 diff --git a/Rotate Matrix by 90 b/Rotate Matrix by 90 new file mode 100644 index 0000000..03db472 --- /dev/null +++ b/Rotate Matrix by 90 @@ -0,0 +1,74 @@ +//ROTATE MATRIX BY 90 +#include +using namespace std; +#define N 105 + +/*input: +1 +4 +1 2 3 4 +5 6 7 8 +9 10 11 12 +13 14 15 16 +output: +4 8 12 16 +3 7 11 15 +2 6 10 14 +1 5 9 13 +*/ + +void rotateby90(int n, int a[][N]){ + + int i,j; + for(i=0;i>t; + while(t--) + { + int n; + cin>>n; + int a[N][N],i,j; + for(i=0;i>a[i][j]; + } + } + + rotateby90(n, a); + + for(i=0;i