Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by kukiel ( 17 years ago )
#include<iostream>
int main()
{
    int t[100][100];
    int n, i, j, lewa, prawa;
    scanf("%d", &n);
    lewa=n/2;
    prawa=n/2;
    for(i=0;i<n;i++)
    {
    t[i][0]=1;
    t[i][n-1]=1;
    t[0][i]=1;
    t[n-1][i]=1;
    }
    for(i=1;i<(n/2)+1;i++)
    {
         t[i][lewa]=1;
         t[i][prawa]=1;
         t[n-1-i][lewa]=1;
         t[n-1-i][prawa]=1;
         lewa--;
         prawa++;     
    }
    for(i=0;i<n;i++)
    {
         for(j=0;j<n;j++)
         {
              if(t[i][j]==1)printf("*");
              else printf(" ");
         }
    printf("n");
    }
    system&#40;"pause"&#41;;
    return 0;
}

 

Revise this Paste

Parent: 12186
Your Name: Code Language: