-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ5.cpp
More file actions
38 lines (32 loc) · 841 Bytes
/
Copy pathQ5.cpp
File metadata and controls
38 lines (32 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
using namespace std;
int main() {
int n,r,c;
cout<<"\t#SQUARE MATRIX"<<endl;
cout<<"\nEnter number of rows/column in matrix : ";
cin>>n;
int ary[n][n];
for (r=0;r<n;r=r+1) {
for (c=0;c<n;c=c+1) {
cout<<"\nEnter element ("<<r+1<<","<<c+1<<") : ";
cin>>ary[r][c];
}
}
cout<<"\n\t\t#Given array in MATRIX form \n\n";
for (r=0;r<n;r=r+1) {
cout<<"\t\t\t";
for(c=0;c<n;c=c+1) {
cout<<ary[r][c]<<" ";
}
cout<<endl;
}
cout<<"\n\t#Give array after 90 degree clockwise rotation \n\n";
for(r=0;r<n;r=r+1) {
cout<<"\t\t\t";
for(c=n-1;c>=0;c=c-1) {
cout<<ary[c][r]<<" ";
}
cout<<endl;
}
return 0;
}