-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_program_1-31-17.c
More file actions
57 lines (50 loc) · 971 Bytes
/
array_program_1-31-17.c
File metadata and controls
57 lines (50 loc) · 971 Bytes
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
#include <stdio.h>
#include <stdlib.h>
int main()
{
int row = 0;
int column = 0;
int num_1 = 1;
int array[3][5];
int array_2[3][5];
// first array
printf("---------------\n");
for(row = 0; row < 3; row++)
{
for(column = 0; column < 5; column++)
{
array[row][column] = num_1;
num_1++;
}
}
for(row = 0; row < 3; row++)
{
for(column = 0; column < 5; column++)
{
printf("%2d ", array[row][column]);
}
printf("\n");
}
printf("---------------\n");
// second array
printf("---------------\n");
num_1 = 1;
for(column = 0; column < 5; column++)
{
for(row = 0; row < 3; row++)
{
array[row][column] = num_1;
num_1++;
}
}
for(row = 0; row < 3; row++)
{
for(column = 0; column < 5; column++)
{
printf("%2d ", array[row][column]);
}
printf("\n");
}
printf("---------------\n");
return 0;
}