-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpattern7.c
More file actions
42 lines (37 loc) · 737 Bytes
/
Copy pathpattern7.c
File metadata and controls
42 lines (37 loc) · 737 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
/*Pattern7*/
/*
for eg.for 5 rows
A
A B
A B C
A B C D
A B C D E
A B C D
A B C
A B
A
*/
#include <stdio.h>
void main()
{
int ch = 64; /*Intialized ASCII 64*/
int row, column, no_of_rows;
printf("Enter the no. of rows: ");
scanf("%d", &no_of_rows);
for (row = 1; row <= no_of_rows; row++)
{
for (column = 1; column <= row; column++)
{
printf("%c ", ch + column); /*To start from A, ch + column gives 65*/
}
printf("\n");
}
for (row = no_of_rows - 1; row >= 1; row--)
{
for (column = 1; column <= row; column++)
{
printf("%c ", ch + column);
}
printf("\n");
}
}