fork download
  1. #include <stdio.h>
  2.  
  3. int main(){
  4. int row, col;
  5. scanf("%d %d", &row, &col);
  6. int matriks[row][col];
  7. for (int i = 0; i < row; i++){
  8. for (int j = 0; j < col; j++){
  9. scanf("%d", &matriks[i][j]);
  10. if (matriks[i][j] != 0){
  11. printf("%4d ", matriks[i][j]);
  12. }
  13. }
  14. printf("\n");
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5316KB
stdin
2 3
5 0 6 2
4 3 0 7
stdout
   5    6 
   2    4    3