diff options
author | smlckz <smlckz@college> | 2021-12-22 14:56:13 +0530 |
---|---|---|
committer | smlckz <smlckz@college> | 2021-12-22 14:56:13 +0530 |
commit | b73983c3717642ca10e7cfe93d97609adc377da9 (patch) | |
tree | a6e9fe4c27e3caa215f8aefa9265fb52f6de4375 /assignments/16-star-pattern-extreme.c | |
download | college-b73983c3717642ca10e7cfe93d97609adc377da9.tar.gz |
backup
Diffstat (limited to 'assignments/16-star-pattern-extreme.c')
-rw-r--r-- | assignments/16-star-pattern-extreme.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/assignments/16-star-pattern-extreme.c b/assignments/16-star-pattern-extreme.c new file mode 100644 index 0000000..97d4d8d --- /dev/null +++ b/assignments/16-star-pattern-extreme.c @@ -0,0 +1,50 @@ +#include <stdio.h> + +int main(void) +{ + int i, j, h; + printf("Enter a height: "); + scanf("%d", &h); + for (i = 1; i <= h; i++) { + for (j = 1; j <= i; j++) { + printf("*"); + } + for (j = 1; j <= 2 * h - 2 * i; j++) { + printf(" "); + } + for (j = 1; j <= i; j++) { + printf("*"); + } + printf("\n"); + } + return 0; +} + +/* +Output: +Set 1: +Enter a height: 4 +* * +** ** +*** *** +******** + +Set 2: +Enter a height: 5 +* * +** ** +*** *** +**** **** +********** + +Set 3: +Enter a height: 6 +* * +** ** +*** *** +**** **** +***** ***** +************ + +*/ + |