Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int ar[100][100];
- int main()
- {
- int n,m,kr=0;
- cin>>n;
- m=n;
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- ar[i][j]=1;
- }
- }
- for(int gr=0; gr<3; gr++){
- kr=gr/2;
- for(int i=gr; i<gr+1; i++){
- for(int j=kr; j+1<n-gr; j++){
- ar[i][j+1]=ar[i][j]+1;
- }
- }
- for(int i=n-1-gr; i<n-gr; i++){
- for(int j=gr; j+1<n-gr; j++){
- ar[j+1][i]=ar[j][i]+1;
- }
- }
- for(int i=n-1-gr; i<n-gr; i++){
- for(int j=n-1-gr; j>0+gr; j--){
- ar[i][j-1]=ar[i][j]+1;
- }
- }
- for(int i=gr; i<gr+1; i++){
- for(int j=n-1-gr; j-1>gr; j--){
- ar[j-1][i]=ar[j][i]+1;
- }
- }
- }
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- cout<<ar[i][j]<<'\t';
- }
- cout<<endl<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement