Advertisement
Guest User

Untitled

a guest
Aug 17th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main ()
  7. {
  8. FILE *f1;
  9. FILE *f2;
  10. f1=fopen("matrica1.txt","r");
  11. f2=fopen("matrica2.txt","w");
  12. float a[100][100];
  13. float b[100][100];
  14. int i,j,m,n;
  15. fscanf(f1,"%d %d",&m,&n);
  16. for(i=0;i<m;i++)
  17. {
  18. for(j=0;j<n;j++)
  19. {
  20. fscanf(f1,"%f",&a[i][j]);
  21. }
  22. }
  23. for(i=0;i<m;i++)
  24. {
  25. for(j=0;j<n;j++)
  26. {
  27. b[j][i]=a[i][j];
  28. }
  29. }
  30. for(i=0;i<m;i++)
  31. {
  32. for(j=0;j<n;j++)
  33. {
  34. fprintf(f2,"%7.2f\n",b[i][j]);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement