TOPIC

presentation error(100%) 1435

iagosilva019_ asked 2 years ago

include

void preencheMatriz(int N, double M[][100]);

void imprimeMatriz(int N, double M[][100]);

int a,b,c,d,e,f,g,h,i,j=1,N,p=0,q=0,r; int main() {

while(1)
{
    scanf("%d", &N);
       double M[N][100];

    if(N==0) break;
    else
    {
        j=1;p=0;q=0;
        int M[N][N];
        i=N;
        if(N%2==0)
            r=N/2;
        else if(N%2==1)
            r=(N/2)+1;

}

    preencheMatriz(N, M);
    imprimeMatriz(N, M);

}

return 0;

}

void preencheMatriz(int N, double M[][100]) {

for(c=1; c<=r; c++) { for(a=p; a<i; a++) { for(b=q; b<i; b++) M[a][b]=j; } j++; p++; q++; i--; }

} void imprimeMatriz(int N, double M[][100]) {

for(g=0; g<N; g++) { for(h=0; h<N; h++) { if(h==0) printf("%3.0f",M[g][h]); else printf("%3.0f",M[g][h]); } printf("\n"); } printf("\n"); }

Remember not post solutions. Your post may be reviewed by our moderators.

  • feodorv replied 2 years ago

    Bee 1001? Are you sure?

    You can use uDebug.