• Matéria: Informática
  • Autor: joaoaugusto151
  • Perguntado 3 anos atrás

Escreva um programa que imprima a seguinte matriz:

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

Respostas

respondido por: zeferinoallan
1

Resposta:

#include <stdio.h>

#define LINHA 3

#define COLUNA 10

int matriz[LINHA][COLUNA];

int main(void)

{

 matriz[0][0] = 10;

 matriz[0][1] = 11;

 matriz[0][2] = 12;

 matriz[0][3] = 13;

 matriz[0][4] = 14;

 matriz[0][5] = 15;

 matriz[0][6] = 16;

 matriz[0][7] = 17;

 matriz[0][8] = 18;

 matriz[0][9] = 19;

 matriz[1][0] = 20;

 matriz[1][1] = 21;

 matriz[1][2] = 22;

 matriz[1][3] = 23;

 matriz[1][4] = 24;

 matriz[1][5] = 25;

 matriz[1][6] = 26;

 matriz[1][7] = 27;

 matriz[1][8] = 28;

 matriz[1][9] = 29;

 matriz[2][0] = 30;

 matriz[2][1] = 31;

 matriz[2][2] = 32;

 matriz[2][3] = 33;

 matriz[2][4] = 34;

 matriz[2][5] = 35;

 matriz[2][6] = 36;

 matriz[2][7] = 37;

 matriz[2][8] = 38;

 matriz[2][9] = 39;

 

 //impressao dos valores

 int i,j;

 for(i = 0; i < LINHA; i++){

   for(j=0; j < COLUNA; j++){

     printf("%i\t",matriz[i][j]);

   }

   printf("\n");

 }  

 return 0;

}

Explicação:

SEGUE O PLANO

Perguntas similares