Skip to content

Commit f4736b0

Browse files
committed
2 problems in this one please check(forgot to create new branch mb)
1 parent 62fa2f3 commit f4736b0

File tree

5 files changed

+39
-101
lines changed

5 files changed

+39
-101
lines changed

.vscode/c_cpp_properties.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include<stdio.h>
2+
3+
void rotate( int matrixSize, int* matrixColSize, int matrix[][*matrixColSize]) {
4+
for(int i=0;i<matrixSize;i++){
5+
for(int j=i;j<(*matrixColSize);j++){
6+
int temp=matrix[i][j];
7+
matrix[i][j]=matrix[j][i];
8+
matrix[j][i]=temp;
9+
}
10+
}
11+
12+
for(int i=0;i<matrixSize;i++){
13+
for(int j=0;j<(*matrixColSize)/2;j++){
14+
int temp=matrix[i][j];
15+
matrix[i][j]=matrix[i][*matrixColSize-1-j];
16+
matrix[i][*matrixColSize-1-j]=temp;
17+
}
18+
}
19+
//AFTER ROTATE
20+
for(int i=0;i<3;i++){
21+
for(int j=0;j<3;j++){
22+
printf("%d ",matrix[i][j]);
23+
}
24+
printf("\n");
25+
}
26+
}
27+
int main(){
28+
int arr[3][3]={1,2,3,4,5,6,7,8,9};
29+
int matrixSize=3, matrixColSize =3;
30+
//BEFORE ROTATE
31+
for(int i=0;i<3;i++){
32+
for(int j=0;j<3;j++){
33+
printf("%d ",arr[i][j]);
34+
}
35+
printf("\n");
36+
}
37+
rotate(matrixSize,&matrixColSize,arr);
38+
39+
}
40.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)