-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17_palindromepattern.c
More file actions
43 lines (31 loc) · 725 Bytes
/
17_palindromepattern.c
File metadata and controls
43 lines (31 loc) · 725 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
#include <stdio.h>
int main()
{
int i, j, rows;
scanf("%d", &rows);
printf("*\n");
for(i=1; i<=rows; i++)
{
for(j=1; j<=i; j++)
{
if(j==1){printf("*");}
printf("%d",j);
}
for(j=i-1; j>=1; j--)
{
printf("%d",j);
}
printf("*\n");
}
for(i=rows-1;i>=1;i--)
{
printf("*");
for(j=1;j<=i;j++)
{printf("%d",j);}
for(j=i-1;j>=1;j--)
{printf("%d",j);}
printf("*\n");
}
printf("*\n");
return 0;
}