-
Notifications
You must be signed in to change notification settings - Fork 0
/
element_printing.c
51 lines (47 loc) · 935 Bytes
/
element_printing.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
#include <stdio.h>
int main()
{
int r, c, i, j;
printf("enter the no of row :");
scanf("%d", &r);
printf("enter the no of column :");
scanf("%d", &c);
int a[r][c];
printf("enter the all elements :\n");
for (int i = 0; i < r; i++)
{
for (j = 0; j < c; j++)
{
scanf("%d", &a[i][j]);
}
}
printf("Elements are :\n");
for (int i = 0; i < r; i++)
{
for (j = 0; j < c; j++)
{
printf("%d", a[i][j]);
}
printf("\n");
}
printf("\n");
for (i = 0; i < c; i++)
{
if (j % 2 == 0)
{
for (j = r - 1; j >= 0; j--)
{
printf("%d ", a[i][j]);
}
}
else
{
for (j = 0; j < r; j++)
{
printf("%d ", a[i][j]);
}
}
printf("\n");
}
return 0;
}