-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdz 7.c
67 lines (48 loc) · 1 KB
/
dz 7.c
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <stdlib.h>
int main()
{
int i, j;
int g=7;
int y=6;
int n=3;
int myArray[g][y]; // îáúÿâëÿåì ìàññèâ ðàçìåðîì g*y ýëåìåíòîâ
for ( i = 0; i < g; i++ ) {
for ( j = 0; j < y; j++ )
myArray[i][j] = i * j; // êàæäîìó ýëåìåíòó ïðèñâàèâàåì çíà÷åíèå ïðîèçâåäåíèÿ òåêóùèõ èíäåêñîâ ýëåìåíòà ìàññèâà
}
printf( "masiv:\n" );
for ( i = 0; i < g; i++ ) {
for ( j = 0; j < y; j++ )
{
printf( "[%d][%d]=%d ", i, j, myArray[i][j] );
}
printf( "\n" );
}
getchar();
int h;
for ( h = 0; h < n; h++ ){
int r[1][y];
for ( j = 0; j < y; j++ ){
r[0][j]=myArray[0][j];
}
for ( i = 0; i < g-1; i++ ){
for ( j = 0; j < y; j++ )
{
myArray[i][j] = myArray[i+1][j];
}
}
for ( j = 0; j < y; j++ ){
myArray[g-1][j]=r[0][j];
}
}
for ( i = 0; i < g; i++ ) {
for ( j = 0; j < y; j++ )
{
printf( "[%d][%d]=%d ", i, j, myArray[i][j] );
}
printf( "\n" );
}
getchar();
for ( i = 0; i < g-1; i++ ){
}
}