fork download
  1. #include <stdio.h>
  2. int main() {
  3. int vetor [9];
  4. int matriz [3][3];
  5. printf("Digite 9 número para uma matriz \n" );
  6. for (int i = 0; i < 9; i++) scanf("%i", &vetor[i]);
  7. for (int lin = 0, k = 0; lin < 3; lin++) {
  8. for (int col = 0; col < 3; col++, k++) {
  9. matriz[lin][col] = vetor[k];
  10. printf("%i\t", matriz[lin][col]);
  11. }
  12. printf("\n");
  13. }
  14. }
  15.  
  16. //https://pt.stackoverflow.com/q/133847/101
Success #stdin #stdout 0s 4232KB
stdin
1
2
3
4
5
6
7
8
9
stdout
Digite 9 número para uma matriz 
1	2	3	
4	5	6	
7	8	9