-
Notifications
You must be signed in to change notification settings - Fork 0
/
palindrome_pattern.c
57 lines (48 loc) · 1.12 KB
/
palindrome_pattern.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
#include<stdio.h>
int main(){
printf("Enter a the number of rows \n");
int rows;
scanf("%d",&rows);
printf("*\n*");
for(int i=1;i<=rows;i++){
for(int c=1;c<i;c++){
if(c==1){
printf("*%d",c);
}
else{
printf("%d",c);
}
}
for(int s=i;s>=1;s--){
if(r==1){
printf("%d*",s);
}
else{
printf("%d",s);
}
}
printf("\n");
}
for(int j=inp1-1;j>=1;j--){
for(int c=1;c<=j;c++){
if(c==1){
printf("*%d",c);
}
else{
printf("%d",c);
}
}
for(int s=j-1;s>=1;s--){
if(s==1){
printf("%d*",s);
}
else{
printf("%d",s);
}
}
if (j!=1){
printf("\n");
}
}
printf("*\n*");
}