-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprac1.c
More file actions
40 lines (37 loc) · 742 Bytes
/
prac1.c
File metadata and controls
40 lines (37 loc) · 742 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
#include<stdio.h>
int main(){
int n;
scanf("%d", &n);
for(int r=1;r<=n;r++){
for(int i=1;i<=n-r;i++){
printf(" ");
}
if(r==1){
printf("*");
}
else{
printf("*");
for(int j=1;j<=(2*r-3);j++){
printf(" ");
}
printf("*");
}
printf("\n");
}
for(int r1=n-1;r1>=1;r1--){
for(int i=1;i<=n-r1;i++){
printf(" ");
}
if(r1==1){
printf("*");
}
else{
printf("*");
for(int j=1;j<=(2*r1-3);j++){
printf(" ");
}
printf("*");
}
printf("\n");
}
}