Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main ()
- {
- FILE *f1;
- FILE *f2;
- f1=fopen("matrica1.txt","r");
- f2=fopen("matrica2.txt","w");
- float a[100][100];
- float b[100][100];
- int i,j,m,n;
- fscanf(f1,"%d %d",&m,&n);
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- fscanf(f1,"%f",&a[i][j]);
- }
- }
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- b[j][i]=a[i][j];
- }
- }
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- fprintf(f2,"%7.2f\n",b[i][j]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement