Jump to content
Fórum Script Brasil
  • 0

Pamella Roberta


Question

Olá, 

Estou com dificuldade para fazer uma matriz 10 x 10 em c, onde tenho que zerar todos os números abaixo da diagonal principal.
Cheguei a fazer assim mas para os números da diagonal abaixo não to conseguindo zerar. 
Se alguém puder me ajudar, agradeço demais. 

 

Void MM (int X[10] [10]) {
                  printf (“\n\n\n’’);
                         int i,j;
               for (i=0; i<10; i++) {
                printf(“\n”);
                        for (j=0; j<10;j++)
                        printf (“\t%d’’, x [j]);
}}

void RR (int x[10] [10]) {                                                 
int i, j;
printf (“\nDigite 10 valores\n”);
for (i=0; i<10; i++)
scanf (“%d”, &x );
for (i=0; i<10; i++)    {
x [j] = i+j;
x[j] = i+j;
}}
 

void DD (int x [10] [10]) {
int i, j, k=0;
for (i=0; i<10; i++)
             for ( j=0;j<10; j++)
                        if (x [j] < k)

                              k = x [j];

for ( i=0; i<10; i++)
            for ( j=0; j<10; j++)
                   if (x [j] = k)
                        x [j] = 0;
}

main () {
int x[10][10]
RR(x);
MM(x);
DD(x);
MM(x);


MM é onde mostra a matriz, RR registra os números da matriz e DD a diagonal 

Edited by Pâmella Roberta
Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148691
    • Total Posts
      644531
×
×
  • Create New...