include stdio include stdlib define int main int argc char argv srand

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
#define N 3
int main(int argc, char *argv[])
{srand(time(NULL));
int mas[N][N],i,j,k,tmp;
//mass rand.
for(i=0;i<N;i++)
for(j=0;j<N;j++)
mas[i][j]=rand()%10;
puts("Massiv:\n");
for(i=0;i<N;i++)
{for(j=0;j<N;j++)
printf("%d ", mas[i][j]);
printf("\n");
}
printf("\n\n\n");
//job
for(i=0;i<N;i++)
for(j=0;j<N;j++)
if(j==i)
{tmp=mas[i][0];
mas[i][0]=mas[i][N-1];
mas[i][N-1]=tmp;
}
//out
for(i=0;i<N;i++)
{for(j=0;j<N;++j)
printf("%d ", mas[i][j]);
printf("\n");
}
system("PAUSE");
return 0;
}