Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- #include <locale.h>
- #include <stdarg.h>
- #define m 3
- #define n 3
- int transpmt(int mt[m][n])
- {
- static int i, j=1, temp;
- if(i<m)
- {
- if(j<n)
- {
- temp=mt[i][j];
- mt[i][j]=mt[j][i];
- mt[j][i]=temp;
- j++;
- return transpmt(mt);
- }
- else
- {
- i++;
- j=i+1;
- return transpmt(mt);
- }
- }
- else
- {
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- printf("%d ", mt[i][j]);
- }
- printf("\n");
- }
- }
- }
- int main()
- {
- int mt[m][n], k=0, i, j;
- setlocale(LC_ALL, "Russian");
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- do{
- fflush(stdin);
- printf("Введите элемент [%d][%d]: ", i, j);
- k = scanf("%d", &mt[i][j]);
- }while(!k);
- }
- }
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- printf("%d ", mt[i][j]);
- }
- printf("\n");
- }
- printf("\n");
- transpmt(mt);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement