fork download
  1. #include <stdio.h>
  2. #include <locale.h>
  3.  
  4. int main()
  5. {
  6. setlocale(LC_ALL, "Portuguese");
  7.  
  8. int linha, coluna, i, j;
  9.  
  10. printf("Quantidade de linhas: ");
  11. scanf("%d", &linha);
  12. printf("Quantidade de colunas: ");
  13. scanf("%d", &coluna);
  14.  
  15. int matriz[linha][coluna];
  16.  
  17. if (coluna >= 2 && linha >= 2)
  18. {
  19. for (i = 0; i < linha; i++)
  20. {
  21. for (j = 0; j < coluna; j++)
  22. {
  23. printf("NĂºmeros da matriz: ");
  24. scanf("%d", &matriz[i][j]);
  25.  
  26. if (matriz[i][j] < 0 || matriz[i][j] > 9)
  27. {
  28. printf("\nErro.\n");
  29. return 1;
  30. }
  31. }
  32. }
  33. }
  34. else
  35. {
  36. printf("\nErro.\n");
  37. return 1;
  38. }
  39.  
  40. }
  41.  
  42.  
Runtime error #stdin #stdout 0s 4704KB
stdin
3
1
stdout
Quantidade de linhas: Quantidade de colunas: 
Erro.