-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1435.cpp
More file actions
57 lines (55 loc) · 1.61 KB
/
Copy path1435.cpp
File metadata and controls
57 lines (55 loc) · 1.61 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int n;
while(1){
cin>>n;
if(n==0){
break;
}else{
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i==1||i==n||j==1||j==n){
cout<<1;
if(j==n){
cout<<endl;
}
if(j!=n){
cout<<" ";
}
}else{
if(i==2||i==n-1||j==2||j==n-1){
cout<<2;
if(j==n){
cout<<endl;
}
if(j!=n){
cout<<" ";
}
}else{
if(i==3||i==n-2||j==3||j==n-2){
cout<<3;
if(j==n){
cout<<endl;
}
if(j!=n){
cout<<" ";
}
}
else{cout<<i;
if(j==n){
cout<<endl;
}
if(j!=n){
cout<<" ";
}
}
}
}
}
}
}
}
return 0;
}