forked from CodeToExpress/dailycodebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPattern_7.c
More file actions
35 lines (30 loc) · 719 Bytes
/
Pattern_7.c
File metadata and controls
35 lines (30 loc) · 719 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
/**
* @author : ashwek
* @date : 26/12/2018
*/
#include<stdio.h>
void main(){
int n, i, j, s;
printf("Enter n = ");
scanf("%d", &n);
//Upper-Half
for(i=1; i <=n; i++){
for(j=i; j<=n; j++) //Left Triangle
printf("* ");
for(s=1; s<i; s++) //Space
printf(" ");
for(j=i; j<=n; j++) //Right Triangle
printf("* ");
printf("\n");
}
//Lower-Half
for(i=1; i <=n; i++){
for(j=1; j<=i; j++) //Left Triangle
printf("* ");
for(s=1; s<=(n-i); s++) //Space
printf(" ");
for(j=1; j<=i; j++) //Right Triangle
printf("* ");
printf("\n");
}
}