Advertisement
Guest User

Untitled

a guest
Aug 17th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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. while(fscanf(f1,"%d %d",&m,&n))
  16. {
  17. for(i=0;i<n;i++)
  18. {
  19. for(j=0;j<m;j++)
  20. {
  21. fscanf(f1,"%f",&a[i][j]);
  22. }
  23. }
  24. }
  25. for(i=0;i<n;i++)
  26. {
  27. for(j=0;j<m;j++)
  28. {
  29. b[j][i]=a[i][j];
  30. }
  31. }
  32. fprintf(f2,"%7.2f\n",b[i][j]);
  33. }
  34. #include <stdio.h>
  35. #include <stdlib.h>
  36. #include <string.h>
  37. #include <ctype.h>
  38.  
  39. int main ()
  40. {
  41. FILE *f1;
  42. FILE *f2;
  43. f1=fopen("matrica1.txt","r");
  44. f2=fopen("matrica2.txt","w");
  45. float a[100][100];
  46. float b[100][100];
  47. int i,j,m,n;
  48. while(fscanf(f1,"%d %d",&m,&n))
  49. {
  50. for(i=0;i<n;i++)
  51. {
  52. for(j=0;j<m;j++)
  53. {
  54. fscanf(f1,"%f",&a[i][j]);
  55. }
  56. }
  57. }
  58. for(i=0;i<n;i++)
  59. {
  60. for(j=0;j<m;j++)
  61. {
  62. b[j][i]=a[i][j];
  63. }
  64. }
  65. fprintf(f2,"%7.2f\n",b[i][j]);
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement