Guest User

Untitled

a guest
Jan 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. {1,2,0,0}
  2. {1,1,0,0}
  3. {1,0,0,0}
  4. {2,3,4,5}
  5.  
  6. 1-2
  7. 1-1
  8. 1
  9. 2-3-4-5
  10.  
  11. #include <stdio.h>
  12. void imprimirMatriz(int (*matriz)[4]){
  13. FILE *fichero = fopen( "salida.txt", "w" );
  14. for( int fila = 0; fila < 4; ++fila ) {
  15. for( int col = 0; col < 4; ++col )
  16. if( matriz[fila][col]!=0 )
  17. fprintf( fichero, "%d-", matriz[fila][col] );
  18. fprintf( fichero, "n" );
  19. }
  20. fclose(fichero);
  21. }
  22. int main(){
  23. int matriz1[4][4] = {
  24. {1,2,0,0},
  25. {1,1,0,0},
  26. {1,0,0,0},
  27. {2,3,4,5},
  28. };
  29. imprimirMatriz(matriz1);
  30. return 0;
  31. }
  32.  
  33. 1-2-
  34. 1-1-
  35. 1-
  36. 2-3-4-5-
Add Comment
Please, Sign In to add comment